Note that there are some explanatory texts on larger screens.

plurals
  1. POreceiving structured data KSOAP2 in Android
    primarykey
    data
    text
    <p>I'm having trouble trying to receive structured data from ksoap getResponse();</p> <p>I've already read carefully guide to send and receive data using SoapObjects from site: <a href="http://www.helloandroid.com/tutorials/using-ksoap2-android-and-parsing-output-data" rel="nofollow">link to site</a></p> <p>I'm using this <a href="https://webapi.allegro.pl/uploader.php?wsdl" rel="nofollow">WSDL</a></p> <p>The object i'm trying to obtain has structure like:</p> <pre><code>&lt;message name="doSearchResponse"&gt; &lt;part name="search-count" type="xsd:int"/&gt; &lt;part name="search-count-featured" type="xsd:int"/&gt; &lt;part name="search-array" type="typens:ArrayOfSearchResponse"/&gt; &lt;part name="search-excluded-words" type="typens:ArrayOfExcludedWords"/&gt; &lt;part name="search-categories" type="typens:ArrayOfCategoriesStruct"/&gt; &lt;/message&gt; </code></pre> <p>I think this is kind of output object that is used in doSearch method:</p> <pre><code>&lt;operation name="doSearch"&gt; &lt;input message="typens:doSearchRequest"/&gt; &lt;output message="typens:doSearchResponse"/&gt; &lt;/operation&gt; </code></pre> <p>This is te code I'm trying to perform search operation and then to get the object I presented above (doSearchResponse).</p> <pre><code>public void search(String searchPhrase) { /* search criteria holder */ SoapObject searchOptType = new SoapObject(API_NAMESPACE, "SearchOptType"); searchOptType.addProperty("search-string", searchPhrase); /* search method */ SoapObject doSearch = new SoapObject(API_NAMESPACE, "doSearch"); doSearch.addProperty("session-handle", sessionToken); doSearch.addProperty("search-query", searchOptType); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); envelope.dotNet = true; envelope.setOutputSoapObject(doSearch); Object response = null; try { transport.call("", envelope); response = envelope.getResponse(); System.out.println(response.getClass()); } catch (XmlPullParserException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } </code></pre> <p>Search works fine, but it returns me only one Object - an single Integer object(not an array) which is the count of found matching items to the searchPhrase. And i think this is the first position in doSearchResponse object. But I need rest of them, especially: search-array. What am I doing wrong? Isn't this sth to deal with envelope.call("and this string here", ...)?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload