SOAP request by org.apache.http.client.HttpClient(4.1)
// SOAP request(xml) read-in
File req_xml = new File("test/xml/request.xml");
// SOAP request send
HttpPost post = new HttpPost("http://localhost:8080/test/api/");
post.setEntity(new InputStreamEntity(new FileInputStream(req_xml), req_xml.length()));
post.setHeader("Content-type", "text/xml; charset=UTF-8");
post.setHeader("SOAPAction", "");
HttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(post);
// SOAP response(xml) get
String res_xml = EntityUtils.toString(response.getEntity());
Written by KOIZUMI teruaki
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Soap
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#