I need to create a soap request like this.
SOAP request
POST /TennisMasters/TennisMasters.Listener.asmx HTTP/1.1 Host: playinkstudio.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://playinktennismasters.com/authenticateUser" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <authenticateUser xmlns="http://playinktennismasters.com/"> <user>string</user> </authenticateUser> </soap:Body> </soap:Envelope>
I am using KSOAP2 to create this request.
private static String SOAP_ACTION = "http://playinktennismasters.com/authenticateUser"; private static String NAMESPACE = "http://playinktennismasters.com/"; private static String METHOD_NAME = "authenticateUser"; private static String URL = "http://playinkstudio.com/TennisMasters/TennisMasters.Listener.asmx"; SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); request.addProperty("user", "A Json String will be here"); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER12); envelope.dotNet = true; envelope.setOutputSoapObject(request); HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); androidHttpTransport.debug = true; try { androidHttpTransport.call(SOAP_ACTION, envelope); } catch (Exception e) { e.printStackTrace(); }
This is the request I received from debugging.
<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://www.w3.org/2003/05/soap-encoding" xmlns:v="http://www.w3.org/2003/05/soap-envelope"> <v:Header /> <v:Body> <authenticateUser xmlns="http://playinktennismasters.com/" **id="o0" c:root="1"**> <user **i:type="d:string"**>{"email":" asad.mahmood@gmail.com ","UserDate":"Feb 22, 2012 7:01:24 PM","GearId":0,"GearValue":0,"Income":0,"Level":0,"MatchResult":0,"MatchType":0,"OfferId":0,"OpponentId":0,"Partners":0,"ExhibitionCount":0,"PowerRuns":0,"PowerServes":0,"PowerShots":0,"Seeds":0,"Energy":0,"Cash":0,"Stamina":0,"Strength":0,"SubLevel":0,"TotalEnergy":0,"TotalStamina":0,"TrainingId":0,"Agility":0,"UserId":0,"Age":0,"ActivityId":0,"gearIsGift":0}</user> </authenticateUser> </v:Body> </v:Envelope>
I do not know why additional attributes, such as "id" and "c: root", are added to authenticateUser. and an optional attribute in i: type = "d: String". Please can someone come along to give me a good example or tutorial that can help me create a query like the one above, really need help.