android - How to Create ksoap2 Request Object -
i struggling creating soap request
following soap request:
<?xml version="1.0"?> <soap-env:envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapsdk1="http://www.w3.org/2001/xmlschema" xmlns:soapsdk2="http://www.w3.org/2001/xmlschema-instance" xmlns:soapsdk3="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/1999/xmlschema-instance" xmlns:xsd="http://www.w3.org/1999/xmlschema"> <soap-env:header/><soap-env:body><ns1:authenticate xmlns:ns1="urn:login" soap-env:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"> <msgstr xsi:type="xsd:string"><message messageid="0"> <entity name="ref_login"> <property name="login_cd" value="abc" type="string"/> <property name="password" value="abc" type="string"/> <property name="machine_name" value="iphone simulator" type="string"/> <property name="language_code" value="en" type="string"/> <property name="client_version_cd" value="xl7.11" type="string"/> </entity> </message></msgstr></ns1:authenticate></soap-env:body></soap-env:envelope>
hope : have posted snip of code here : replace ur values appropriately
soapobject request = new soapobject(namespace, method_name); propertyinfo propinfo1 = new propertyinfo(); propinfo1.setname("input_if_any"); propinfo1.setvalue(1); propinfo1.settype(int.class); request.addproperty(propinfo1); soapserializationenvelope envelope = new soapserializationenvelope( soapenvelope.ver11); envelope.dotnet = true; // put if web service .net 1 envelope.setoutputsoapobject(request); httptransportse androidhttptransport = new httptransportse(url); try { androidhttptransport.call(soap_action, envelope); // soapprimitive response = (soapprimitive)envelope.getresponse(); object response1 = envelope.getresponse(); soapobject response = (soapobject) response1; log.i("myapp", response1.tostring()); if (response1.tostring().equalsignorecase("true")) { result = true; }
Comments
Post a Comment