Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I finally got it to work!</p> <p>Turns out my android ksoap2 code didn't like the default namespace(tempuri.org) set by WCF in the SOAP service.</p> <p>My guess is that with the default namespace, the request envelop was unable to map the passed testadd object to the datacontract in which the testadd class is defined in the service. By defining a namespace explicitly to the servicecontract and datacontract in the WCF service, this changes/rearranges the wsdl and makes the datacontract accessible. </p> <p>I followed this tutorial to get rid of the tempuri.org namespace- <a href="http://blogs.msdn.com/b/endpoint/archive/2011/05/12/how-to-eliminate-tempuri-org-from-your-service-wsdl.aspx">http://blogs.msdn.com/b/endpoint/archive/2011/05/12/how-to-eliminate-tempuri-org-from-your-service-wsdl.aspx</a></p> <p>I added the following in the appropriate places in the service code (VB)</p> <pre><code>&lt;ServiceContract(Namespace:="http://wcfservicetest.org/Service1")&gt; _ &lt;DataContract(Namespace:="http://wcfservicetest.org/Service1")&gt; _ &lt;ServiceBehavior(Namespace:="http://wcfservicetest.org/Service1")&gt; _ </code></pre> <p>I changed my namespace to "http://wcfservicetest.org/Service1" and edited NAMESPACE and SOAP_ACTION in the android java code with the new namespace.</p> <p>After doing this I got the result I wanted!</p> <p>Here is the soap request: </p> <pre><code>&lt;v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;v:Header /&gt; &lt;v:Body&gt; &lt;ksoapAdd xmlns="http://wcfservicetest.org/Service1" id="o0" c:root="1"&gt; &lt;n0:num1 xmlns:n0="http://wcfservicetest.org/Service1"&gt; &lt;number_1&gt;25&lt;/number_1&gt; &lt;number_2&gt;25&lt;/number_2&gt; &lt;/n0:num1&gt; &lt;/ksoapAdd&gt; &lt;/v:Body&gt; &lt;/v:Envelope&gt; </code></pre> <p>soap response:</p> <pre><code>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;s:Body&gt; &lt;ksoapAddResponse xmlns="http://wcfservicetest.org/Service1"&gt; &lt;ksoapAddResult&gt;50&lt;/ksoapAddResult&gt; &lt;/ksoapAddResponse&gt; &lt;/s:Body&gt; &lt;/s:Envelope&gt; </code></pre> <p>So my advice to anyone else learning SOAP services with ksoap2, do no use the default namespace, set your own namespace. I wasted a week trying to figure this out.</p> <p>Hope this helps someone someday!!</p>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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