android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -
i trying hit soap api in application login purpose , getting above mentioned error , can 1 tell me going wrong , first time soap apis. here code hit soap :-
vector<object> args = new vector<object>(); hashtable<string, object> hashtable = new hashtable<string, object>(); hashtable.put("email", "mss.siddhart28@gmail.com"); hashtable.put("password", "siddharth"); args.add(hashtable); soapserializationenvelope envelope = new soapserializationenvelope( soapenvelope.ver11); envelope.dotnet = true; envelope.xsd = soapserializationenvelope.xsd; envelope.enc = soapserializationenvelope.enc; (new marshalhashtable()).register(envelope); httptransportse androidhttptransport = new httptransportse( "http://tempuri.org/", 15000); androidhttptransport.debug = true; string result = ""; try { soapobject request = new soapobject("http://tempuri.org", "call"); request.addproperty("resourcepath", "user_login"); request.addproperty("args", args); envelope.setoutputsoapobject(request); androidhttptransport.call("call", envelope); envelope.setoutputsoapobject(request); result = envelope.getresponse().tostring(); toast.maketext(mainactivity.this, "envelope is" + envelope, toast.length_long).show(); system.out.println("result signup: " + result); } catch (eofexception e) { e.printstacktrace(); return "restart"; }
and here wsdl :-
post /w4w/w4wservice.asmx http/1.1 host: 64.31.2.58 content-type: text/xml; charset=utf-8 content-length: length soapaction: "http://tempuri.org/user_login" <?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> <user_login xmlns="http://tempuri.org/"> <email>string</email> <password>string</password> </user_login> </soap:body> </soap:envelope>
any appreciated.
thanks
finally solve problem .. here posting code others can help.
private string soap_action = "http://tempuri.org/user_login"; private string method_name = "user_login"; private string namespace = "http://tempuri.org/"; private string url = "http://64.31.2.58:8080/w4w/w4wservice.asmx";
public string login() { soapserializationenvelope envelope = new soapserializationenvelope( soapenvelope.ver11); envelope.dotnet = true; envelope.xsd = soapserializationenvelope.xsd; envelope.enc = soapserializationenvelope.enc; (new marshalhashtable()).register(envelope); httptransportse androidhttptransport = new httptransportse( url, 15000); androidhttptransport.debug = true; string result = ""; try { soapobject request = new soapobject(namespace, method_name); request.addproperty("email", email); request.addproperty("password", password); envelope.setoutputsoapobject(request); androidhttptransport.call(soap_action, envelope); result = envelope.getresponse().tostring(); system.out.println("result signup: " + result); } catch (eofexception e) { e.printstacktrace(); return "restart"; } catch (soapfault e) { e.printstacktrace(); if (e.getmessage() .contains("session expired. try re-login.")) { return "restart"; } return "email exists"; } catch (nullpointerexception e) { e.printstacktrace(); return "restart"; } catch (exception e) { e.printstacktrace(); return ""; } system.out.println("registration result :" + result); return result; }
Comments
Post a Comment