Skip navigation
Currently Being Moderated

Sharepoint getlistitem with query

Jun 15, 2012 9:37 AM

Tags: #sharepoint #webservice

I have an Flashbuilder 4.6 application that connects to SharePoint 2010 via the list web service calling getlistitems. It works fine until I try to add a query parameter. Below is my webservice in the application that works returning all list items.


<mx:WebService id="SPws" wsdl="{wsdurl}" endpointURI="http://rich-hp/_vti_bin/Lists.asmx" fault="wsdlFault(event)" load="SPws_loadHandler(event)" >
<mx:operation name="GetListItems"   fault="GLIFault(event)"  result="GLIResult(event)"   >
   <mx:request   xmlns="http://schemas.microsoft.com/sharepoint/soap/"  > 
     <listName>{listid}</listName>    
     <rowLimit>1000</rowLimit>
   </mx:request>
  </mx:operation>
</mx:WebService>

 

The problem is when I add the CAML query in red below SP throws an exception.

 

<mx:WebService id="SPws" wsdl="{wsdurl}" endpointURI="http://rich-hp/_vti_bin/Lists.asmx" fault="wsdlFault(event)"load="SPws_loadHandler(event)" >

<mx:operation name="GetListItems" fault="GLIFault(event)" result="GLIResult(event)" >
<mx:request xmlns="http://schemas.microsoft.com/sharepoint/soap/" >
  <listName>{listid}</listName>
  <rowLimit>1000</rowLimit>

  <soap:query xmlns="http://schemas.microsoft.com/sharepoint/soap/">
   <soap:Where >
    <soap:Eq >
     <soap:FieldRef Name="CaseNumber" />
     <soap:Value Type="Text">AAA=9000</soap:Value>
    </soap:Eq>
   </soap:Where>
  </soap:query>

</mx:request>
</mx:operation> 

</mx:WebService>


?

The exact same call from SoupUI works.


Using Charles, I traced the request and can see why the error is happening. Below is the request Flex is sending tho SP.

 


<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <SOAP-ENV:Body>
    <tns:GetListItems xmlns:tns="http://schemas.microsoft.com/sharepoint/soap/">
      <tns:listName>452DA74C-4F14-44A5-B614-C4C4CEDEB06A</tns:listName>
      <tns:query>
        <tns:Name>CaseNumber</tns:Name>
        <tns:Value>AAA=9000</tns:Value>
      </tns:query>
      <tns:rowLimit>1000</tns:rowLimit>
    </tns:GetListItems>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 

Here's the request that works from SoapUI

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.microsoft.com/sharepoint/soap/">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:GetListItems>
         <soap:listName>452DA74C-4F14-44A5-B614-C4C4CEDEB06A</soap:listName>
         <soap:rowLimit>1000</soap:rowLimit>
          <soap:Query>
   <soap:Where>
    <soap:Eq>
     <soap:FieldRef Name="CaseNumber" />
     <soap:Value Type="Text">AAA=9000</soap:Value>
    </soap:Eq>
   </soap:Where>
  </soap:Query>
      </soap:GetListItems>
   </soapenv:Body>
</soapenv:Envelope>

 

Notice how the query is being reformated and changed when sent from the application. My question is is this a bug or is there someway to force flex to send the query as it is written?

 

The excwption thrown is -  Element <Query> of parameter query is missing or invalid.

This makes sense since it is invalid

 


Rich Ruiz

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points