I have successfully accessed web services using ksoap2 but i am stuck with 
calling a web service method with data contracts.

The webservice request in SoapUI is shown as :

<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";><soapenv:Header/><soapenv:Body>
  <tem:PatientLookups>
     <tem:oBenefitsandEligibilityEntity>
        <pat:ID>?</pat:ID>
        <pat:Name>?</pat:Name>
        <pat:Age>?</pat:Age>
        <pat:Address>?</pat:Address>
      </tem:oBenefitsandEligibilityEntity>
   </tem:PatientLookups>
 </soapenv:Body>

The arguments ID,Name,Age and Address have different namespaces

Here is the code i used to create the request:

request=new SoapObject(NAMESPACE,"PatientLookups");SoapObject sub_element=new 
SoapObject(NAMESPACE, "oBenefitsandEligibilityEntity");


    for(Map.Entry<String,String> 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);

but i get this exception in logcat:

 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/:oBenefitsandEligibilityEntity. The 
 InnerException message was 'Error in line 1 position 411. Element   
 'http://tempuri.org/:oBenefitsandEligibilityEntity' contains data from a type 
that 
 maps to the name 'http://tempuri.org/:oBenefitsandEligibilityEntity'. The 
deserializer 
 has no knowledge of any type that maps to this name. Consider using a 
 DataContractResolver or add the type corresponding to 
'oBenefitsandEligibilityEntity' 
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)
at 
com.m2.action.WebServiceConnection.callWCFWebService(WebServiceConnection.java:

how to create this soap request using ksoap?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to