The XML (DataSet) is passed as an argument in Android KSOAP2

Source: Internet
Author: User
Tags dotnet soap

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.