i trying response soap webservice, getting error, please check whether calling web service or not. following wsdl of webservice
<wsdl:definitions name="mobileeservicewsd" targetnamespace="urn:mobileeservicewsd"><wsdl:import location="http://vddp.dewa.gov.ae:50700/mobileeservice/config2/bindings?wsdl&style=document" namespace="urn:mobileeservicewsd/config2/document"/><wsdl:service name="mobileeservice"><wsdl:port name="config2port_document" binding="bns0:config2binding"><soap:address location="http://vddp.dewa.gov.ae:50700/mobileeservice/config2?style=document"/></wsdl:port></wsdl:service></wsdl:definitions>
and following code.
private static final string method_name = "getoutstandingbalance"; private static final string soap_action = "mobileeservice"; private static final string namespace = "mobileeservicewsd/config2/document"; private static final string url = "http://vddp.dewa.gov.ae:50700/mobileeservice/config2/bindings?wsdl&style=document"; public soapobject testmethod(string method_name, string soap_action, string namespace, string url) throws ioexception, xmlpullparserexception { //list<headerproperty> headers = new arraylist<headerproperty>(); soapobject request = new soapobject(namespace, method_name); soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver11); envelope.dotnet = true; //for .net services envelope.bodyout = "<soapenv:envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:mobileeservicevi\">"+ "<soapenv:header/>"+ "<soapenv:body>"+ "<urn:getoutstandingbalance>"+ "<urn:contractaccount>000001000104</urn:contractaccount>"+ "<urn:mobileosver>ios 4.3</urn:mobileosver>"+ "<urn:appver>3.3</urn:appver>"+ "<urn:appidentifier>343534</urn:appidentifier>"+ "</urn:getoutstandingbalance>"+ "</soapenv:body>"+ "</soapenv:envelope>"; envelope.setoutputsoapobject(request); httptransportse httptransport = new httptransportse(url); //httptransport.call(soap_action, envelope, headers); httptransport.call(soap_action, envelope); return (soapobject) envelope.getresponse(); }
using ksoap2 library , write .net web service sucessful connection asp.net webservice----- package productverificationcard.in; import org.ksoap2.soapenvelope; import org.ksoap2.serialization.soapobject; import org.ksoap2.serialization.soapserializationenvelope; import org.ksoap2.transport.httptransportse; import android.app.activity; import android.content.intent; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.textview; public class adminlogin extends activity { /** called when activity first created. */ button btn_ok; textview textview; private static final string soap_action = "http://tempuri.org/login"; private static final string operation_name = "login"; private static final string wsdl_target_namespace = "http://tempuri.org/"; private static final string soap_address = "http://10.0.2.2/new/webservice.asmx"; string s; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); btn_ok=(button) findviewbyid(r.id.btn_login); textview=(textview) findviewbyid(r.id.tv_error); btn_ok.setonclicklistener(new onclicklistener() { public void onclick(view v) { soapobject request = new soapobject(wsdl_target_namespace, operation_name); soapserializationenvelope envelope = new soapserializationenvelope( soapenvelope.ver11); envelope.dotnet = true; envelope.setoutputsoapobject(request); httptransportse httptransport = new httptransportse(soap_address); try { httptransport.call(soap_action, envelope); object response = envelope.getresponse(); //textview.settext(response.tostring()); s=response.tostring(); if(s=="true") { intent intent=new intent(adminlogin.this,menuform.class); startactivity(intent); } else { textview.settext("enter valid username or password"); } } catch (exception exception) { textview.settext(exception.tostring()); } // todo auto-generated method stub } }); } }
Comments
Post a Comment