Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to create soap request in ksoap2 for a wcf webservice method with complex types?
    primarykey
    data
    text
    <p>I have successfully accessed web services using ksoap2 but i am stuck with calling a web service method with data contracts.</p> <p>The webservice request in SoapUI is shown as :</p> <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:pat="http://schemas.datacontract.org/2004/07/Patient_Service.App_Code.Common"&gt; &lt;soapenv:Header/&gt; &lt;soapenv:Body&gt; &lt;tem:PatientLookups&gt; &lt;tem:oPatientDetails&gt; &lt;pat:ID&gt;?&lt;/pat:ID&gt; &lt;pat:Name&gt;?&lt;/pat:Name&gt; &lt;pat:Age&gt;?&lt;/pat:Age&gt; &lt;pat:Address&gt;?&lt;/pat:Address&gt; &lt;/tem:oPatientDetails&gt; &lt;/tem:PatientLookups&gt; &lt;/soapenv:Body&gt; </code></pre> <p></p> <p>The arguments ID,Name,Age and Address have different namespaces </p> <p>Here is the code i used to create the request:</p> <pre><code>request=new SoapObject(NAMESPACE,"PatientLookups"); SoapObject sub_element=new SoapObject(NAMESPACE, "oPatientDetails"); for(Map.Entry&lt;String,String&gt; entry: properties.entrySet()) { PropertyInfo pi=new PropertyInfo(); pi.setNamespace(entityNameSpace); pi.setName(entry.getKey()); pi.setValue(entry.getValue()); sub_element.addProperty(pi); } request.addSoapObject(sub_element); </code></pre> <p>but i get this exception in logcat:</p> <pre><code> SoapFault - faultcode: 'a:DeserializationFailed' faultstring: 'The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:oPatientDetails. The InnerException message was 'Error in line 1 position 411. Element 'http://tempuri.org/:oPatientDetails' contains data from a type that maps to the name 'http://tempuri.org/:oPatientDetails'. The deserializer has no knowledge of any type that maps to this name. Consider using a DataContractResolver or add the type corresponding to 'oPatientDetails' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer.'. Please see InnerException for more details.' faultactor: 'null' detail: null at org.ksoap2.serialization.SoapSerializationEnvelope.parseBody(SoapSerializationEnvelope.java:141) at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:140) at org.ksoap2.transport.Transport.parseResponse(Transport.java:100) at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:214) at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:96) </code></pre> <p>how to create this soap request using ksoap?</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. 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