Reputation: 763
I try to understand how use ksoap on Android. I have executed this ksoap request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:namespace">
<soapenv:Header/>
<soapenv:Body>
<urn:"method name">
<urn:mode>"value"</urn:mode>
</urn:method name>
</soapenv:Body>
</soapenv:Envelope>
in entity part of HttpPost via AndroidHttpClient. I try do similar with ksoap:
SoapObject root = new SoapObject(NAMESPACE, "method name");
PropertyInfo pr = new PropertyInfo();
mode.setName("mode");
mode.setValue("value");
root.addProperty(pr);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(root/*request*/);
Log.d(TAG, envelope.toString());
HttpTransportSE transport = new HttpTransportSE(url);
try {
transport.call(NAMESPACE.concat("/").concat("method name"), envelope);
Object obj = (Entity) envelope.getResponse();
, but I have got an exception
SoapFault - faultcode: 'SOAP-ENV:Server' faultstring: 'Processing Failure' faultactor: 'null' detail: org.kxml2.kdom.Node@44f7cab0
Could you please give me an example of this simple request to understand how it works?
Upvotes: 0
Views: 2419
Reputation: 763
Solutuion:
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.implicitTypes = true;
SoapObject root = new SoapObject(NAMESPACE, "method name");
PropertyInfo mode = new PropertyInfo();
mode.setNamespace(NAMESPACE);
mode.setName("mode");
mode.setValue("value");
mode.setType(String.class);
root.addProperty (mode);
//root.addProperty("mode", "value");
envelope.setOutputSoapObject(root/*request*/);
Log.d(TAG, envelope.toString());
HttpTransportSE transport = new HttpTransportSE(url);
transport.debug = true;
try {
transport.call(NAMESPACE.concat("/").concat("Method of server"), envelope);
Log.d(Qube.TAG, transport.requestDump);
Log.d(Qube.TAG, transport.responseDump);
*order is important if you wnat to avoid types in xml
Upvotes: 2