4

In response by

transport.call(SOAP_ACTION, envelope, headerList);

in debug mode in responseDump I have xml like this

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/"><GetListItemsResult><listitems xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
     xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
     xmlns:rs='urn:schemas-microsoft-com:rowset'
     xmlns:z='#RowsetSchema'>
<rs:data ItemCount="5">
   <z:row ows_Attachments='0' ows_LinkTitle='testtask1' ows_Status='Not Started' ows_Priority='(2) Normal' ows_Predecessors='' ows__ModerationStatus='0' ows__Level='1' ows_Title='testtask1' ows_ID='1' ows_UniqueId='1;#{A6E41E02-46FD-4363-A4A3-440AF902B280}' ows_owshiddenversion='1' ows_FSObjType='1;#0' ows_Created_x0020_Date='1;#2012-02-28 09:55:49' ows_Created='2012-02-28 09:55:49' ows_FileLeafRef='1;#1_.000' ows_PermMask='0x7fffffffffffffff' ows_Modified='2012-02-28 09:55:49' ows_FileRef='1;#Lists/Tasks/1_.000' />
   <z:row ows_Attachments='0' ows_LinkTitle='testtask2' ows_Status='Not Started' ows_Priority='(1) High' ows_Predecessors='' ows__ModerationStatus='0' ows__Level='1' ows_Title='testtask2' ows_ID='2' ows_UniqueId='2;#{A320D923-8BC8-4341-B40A-4D39C1FB01DB}' ows_owshiddenversion='1' ows_FSObjType='2;#0' ows_Created_x0020_Date='2;#2012-02-28 09:55:58' ows_Created='2012-02-28 09:55:58' ows_FileLeafRef='2;#2_.000' ows_PermMask='0x7fffffffffffffff' ows_Modified='2012-02-28 09:55:58' ows_FileRef='2;#Lists/Tasks/2_.000' />
   <z:row ows_Attachments='0' ows_LinkTitle='testtask3' ows_Status='In Progress' ows_Priority='(2) Normal' ows_Predecessors='' ows__ModerationStatus='0' ows__Level='1' ows_Title='testtask3' ows_ID='3' ows_UniqueId='3;#{84071EBA-F38D-4EA9-A912-F8DD0088BD38}' ows_owshiddenversion='1' ows_FSObjType='3;#0' ows_Created_x0020_Date='3;#2012-02-28 09:56:07' ows_Created='2012-02-28 09:56:07' ows_FileLeafRef='3;#3_.000' ows_PermMask='0x7fffffffffffffff' ows_Modified='2012-02-28 09:56:07' ows_FileRef='3;#Lists/Tasks/3_.000' />
   <z:row ows_Attachments='0' ows_LinkTitle='testtask4' ows_Status='Waiting on someone else' ows_Priority='(3) Low' ows_Predecessors='' ows__ModerationStatus='0' ows__Level='1' ows_Title='testtask4' ows_ID='4' ows_UniqueId='4;#{AD6ED317-3F07-4998-89D2-38D8B6F0756E}' ows_owshiddenversion='1' ows_FSObjType='4;#0' ows_Created_x0020_Date='4;#2012-02-28 09:56:16' ows_Created='2012-02-28 09:56:16' ows_FileLeafRef='4;#4_.000' ows_PermMask='0x7fffffffffffffff' ows_Modified='2012-02-28 09:56:16' ows_FileRef='4;#Lists/Tasks/4_.000' />
   <z:row ows_Attachments='0' ows_LinkTitle='testtask5' ows_Status='Not Started' ows_Priority='(2) Normal' ows_Predecessors='' ows__ModerationStatus='0' ows__Level='1' ows_Title='testtask5' ows_ID='5' ows_UniqueId='5;#{50BC423F-E6A5-4719-B734-E528A08AE83B}' ows_owshiddenversion='1' ows_FSObjType='5;#0' ows_Created_x0020_Date='5;#2012-02-28 19:22:52' ows_Created='2012-02-28 19:22:52' ows_FileLeafRef='5;#5_.000' ows_PermMask='0x7fffffffffffffff' ows_Modified='2012-02-28 19:22:52' ows_FileRef='5;#Lists/Tasks/5_.000' />
</rs:data>
</listitems></GetListItemsResult></GetListItemsResponse></soap:Body></soap:Envelope>

But method envelope.getResponse() return text below

anyType{listitems=anyType{data=anyType{row=anyType{}; row=anyType{}; row=anyType{}; row=anyType{}; row=anyType{}; }; }; }

UPD1 I read this acticle, but it's not solution for my response.

Ok, I'm trying parse the answer as below

 transport.call(SOAP_ACTION2, envelope, headerList); // 1st step - call soap query
 SoapObject response = (SoapObject) envelope.getResponse();
 SoapObject soapObject = (SoapObject) envelope.getResponse();
 String title= null;
    for (int i = 0; i < soapObject.getPropertyCount(); i++) { // soapObject.getPropertyCount()  is only one (!!!!)
        SoapObject resource = (SoapObject) response.getProperty(i); // in resource only this - anyType{data=anyType{row=anyType{}; row=anyType{}; row=anyType{}; row=anyType{}; row=anyType{}; }; }
        title = resource.getAttribute("ows_Title").toString();
....
Gorets
  • 2,434
  • 5
  • 27
  • 45
  • Can you also elaborate what the exact problem is you are having? – bvanvelsen - ACA Group Feb 29 '12 at 14:24
  • I can catch xml from *String response = transport.responseDump;* but what should I do next step? Or How can I parse this string? – Gorets Feb 29 '12 at 14:37
  • I meet the same question as you, have you fixed this problem now? – JacobChan May 10 '13 at 08:11
  • I am not remember solution, cause the project was close, but I think the problems in user' permissions or this method doesn't correct for it. Try to read msdn.com, I worked with sharepoint soap and its not easy to use. – Gorets May 13 '13 at 14:49

1 Answers1

3

have you tried something like this:

SoapObject soapObject = envelope.getResponse();
for (int i = 0; i < soapObject.getPropertyCount(); i++) {
        SoapObject resource = (SoapObject) response.getProperty(i);
        String uri = resource.getAttribute("uri").toString();
        String mimeType = resource.getAttribute("mimeType").toString();
        String size = resource.getAttribute("size").toString();
        String localURI = resource.getAttribute("localURI").toString();
        //do stuff
}    

note: this is an example I use to get properties from a list of resources

this example loops over the tags of the response SOAP object and gets the 3 known attributes of each tag, see example response below:

<resources xmlns="http://www.example.com/">
    <resource mimeType="text/xml" size="123456" uri="https://example.com/content/get.php?a123891" localURI="package.opf"/>
    <resource mimeType="application/x-dtbncx+xml" size="123456"  localURI="nav.ncx"/>
</resources>
bvanvelsen - ACA Group
  • 1,741
  • 1
  • 14
  • 25
  • I understood this idea, but I have bad data in *envelope.getResponse()* (like in the sample code in the question) and this does not allows me parse correct data. – Gorets Feb 29 '12 at 14:44
  • @Gorets you can parse as in my example, cast the response to 'SoapObject' and loop over the rows, and parse their values... the 'toString' might give you the impression that you 'getResponse' is empty, but that might might not be the case, the 'toString' is just returning an empty string maybe – bvanvelsen - ACA Group Feb 29 '12 at 15:02
  • 1st my query to auth wsdl service returned correct response, but next query with added auth data in header is wrong – Gorets Mar 01 '12 at 10:59