web services - Calling SOAP webservice using java -


i using below code invoke soap based webservice. while invoking need check client side, whether invocation success or not. need not wait response webservice.

is there response code or way, client know invocation success , payload passed correct.

         url = new url(webserviceurl);         urlconnection connection = url.openconnection();         httpurlconnection httpconn = (httpurlconnection) connection;         bytearrayoutputstream bout = new bytearrayoutputstream();         string xmlinput =             " <soapenv:envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +             "   <soapenv:body>\n" + bodycontent + "   </soapenv:body>\n" + "</soapenv:envelope>";         byte[] buffer = new byte[xmlinput.length()];         buffer = xmlinput.getbytes();         bout.write(buffer);         byte[] b = bout.tobytearray();         httpconn.setrequestproperty("content-length", string.valueof(b.length));         httpconn.setrequestproperty("content-type", "text/xml; charset=utf-8");         httpconn.setrequestmethod("post");         httpconn.setdooutput(true);         httpconn.setdoinput(true);         outputstream out = httpconn.getoutputstream();         out.write(b);         out.close(); 

regards, stalin

            soapobject send = new soapobject("your namespace"," methods"); 

// add many parameters need send web service method or none if don't have

send.addproperty("intid", 0);                soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver12);             envelope.setoutputsoapobject(send);              envelope.dotnet = true;              httptransportse androidhttptransport = new httptransportse("your soap_address");             androidhttptransport.call("your soap_action", envelope);              soapobject result = (soapobject) envelope.getresponse();             string s = result.tostring(); 

make sure add ksop2 library project use this,

you can gather information soap_address,namespace,methods , soap_address wsdl document provided run in browser


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -