Search code examples
javaandroidksoap

Requesting only a part of response?


I'm rather new to kSOAP. I have a webservice that has a huge response with an array filled with objects and a little bit of extra data outside of the array. Requesting the entire XML with a normal getResponse() takes about 5-10 seconds. This will get me an entire array that I won't be using for anything.

My question is now, is there a way to only get the little part of data outside of the array without having to change the webservice itself, as I do not have access to change the webservice?

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body>
  <GetResponse xmlns="http://tempuri.org/">
     <GetResult>
        <a:Wrap>
           <a:Country>DK</a:Country>
           <a:ID>155</a:ID>
           <a:SecondWrap>
              <a:Pattern>
                 <b:ListPattern>
                    <b:Type>Price</b:Type>
                    <b:Day>1</b:Day>
                    <b:Hour>1</b:Hour>
                    <b:ListId>007</b:ListId>
                    <b:Price>135</b:Price>
                 </b:ListPattern>
                 <b:ListPattern>
                    <b:Type>Price</b:Type>
                    <b:Day>1</b:Day>
                    <b:Hour>2</b:Hour>
                    <b:ListId>007</b:ListId>
                    <b:Price>135</b:Price>
                 </b:ListPattern>
                 ...
                 ...
                 ...

This is a small cut of the XML response. I wan't to know only the country and ID of the Wrap object, and completely exclude the ListPattern. I don't even want to get the ListPattern. This is a question of performance optimization. So is there a way I can get only country and ID and not even "download" the SecondWrap?


Solution

  • The only way to do that would be to define a new method that return only these values.

    You can't tell the service to bring you only parts of the answer.