Pergunta

Em resposta por

transport.call(SOAP_ACTION, envelope, headerList);

no modo de depuração em respostaDump Eu tenho xml assim

<?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>

Mas método envelope.getResponse() retorne o texto abaixo

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

UPD1eu li isso artigo, mas não é a solução para minha resposta.

Ok, estou tentando analisar a resposta conforme abaixo

 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();
....
Foi útil?

Solução

você já tentou algo assim:

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
}    

observação:este é um exemplo que uso para obter propriedades de uma lista de recursos

este exemplo percorre as tags do objeto SOAP de resposta e obtém os 3 atributos conhecidos de cada tag, veja o exemplo de resposta abaixo:

<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>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top