The code below seemingly executes the web service and returns values, but ignores the where clause (thus returning all items in the list). This is the simplest form of the problem that I've come up with.
The TestQuery list is a simple custom list with no user defined fields. Can anyone see why the filter is not working?
<body>
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var soapEnv = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'><soapenv:Body><GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>";
soapEnv += "<listName>TestQuery</listName>";
soapEnv += "<Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>One</Value></Eq></Where></Query>";
soapEnv += "<ViewFields><ViewFields><FieldRef Name='Title'/></ViewFields></ViewFields><RowLimit>1</RowLimit>";
soapEnv += "</GetListItems></soapenv:Body></soapenv:Envelope>";
$.ajax({
url: "_vti_bin/lists.asmx",
type: "POST",
dataType: "xml",
data: soapEnv,
complete: processResult,
contentType: "text/xml; charset=\"utf-8\""
});
});
function processResult(xData, status) {
$('#WSResponse').text(status);
$(xData.responseXML).find("z\\:row").each(function() {
var liHtml = "<li>" + $(this).attr("ows_Title") + "</li>";
$("#tasksUL").append(liHtml);
});
//}
}
</script>
<ul id="tasksUL"/>
<div id="WSResponse"/>
</body>