I need to send WebService in my Android app, so I used KSOP2 to send it, not very well during the testing process, not working properly.
My Web Service request format is as follows
<envelope xmlns= "http://schemas.xmlsoap.org/soap/envelope/" > <Body> <updatevehicleviaobj xmlns= "http://tempuri.org/" > <userhash>[string? </userHash> <vehicleObject> <colour xmlns= "http://schemas.datacontract.org/2004/07/ StockService ">[string?" </Colour> <comments xmlns= "Http://schemas.datacontract.org/2004/07/StockService" >[string? </Comments> <condition xmlns= "Http://schemas.datacontract.org/2004/07/StockService" >[string? </Condition> </vehicleObject> </UpdateVehicleViaObj> </body></envelope >
I use KSOAP2 in the Android code as follows
Soapobject request = new Soapobject ("Namespace", "MethodName"); Request.addproperty (properyobject); Soapserializationenvelope envelope = new Soapserializationenvelope (SOAPENVELOPE.VER11); SOAP is implemented in DotNet True/false. Envelope.dotnet = true; Marshaldouble MD = new marshaldouble (); Envelope.implicittypes = true; Envelope.implicittypes = true; Md.register (envelope); Set request data into envelope and send request using HttpTransport envelope.setoutputsoapobject (request); Httptransportse androidhttptransport = new Httptransportse (Minobj.geturl (), networktimeout); androidhttptransport.debug= true; Androidhttptransport.call (SOAPAction, envelope,headerpropertyarraylist);
KSOP2 after processing the request, it becomes this
<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/" >< V:header/><v:body><updatevehicleviaobj xmlns= "http://tempuri.org/" id= "O0" c:root= "1" ><userhash >B5B2FDF87E848946</userHash><vehicleObject><Colour>red</Colour><&< Comments >red</comments ><<condition >red</condition ><</vehicleobject></ Updatevehicleviaobj></v:body></v:envelope>
Distress:
Processing methods
Check out the official KSOAP2 documentation
Https://code.google.com/p/ksoap2-android/wiki/CodingTipsAndTricks#sending/receiving_array_of_complex_types_or_primitives
You can create a class that implements the Marshable interface and add additional properties to the class
Original address: http://www.itmmd.com/201412/296.html
This article by Meng Meng's IT person to organize the release, reprint must indicate the source.
The XML (DataSet) is passed as an argument in Android KSOAP2