Created
February 7, 2012 06:38
-
-
Save jihao/1757709 to your computer and use it in GitHub Desktop.
post soap request using apache-common-httpclient
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void postSOAPXML(String soapBody) | |
{ | |
try { | |
// Get target URL | |
HttpClient httpclient = new DefaultHttpClient(); | |
StringEntity strEntity = new StringEntity(soapBody, "text/xml", "UTF-8"); | |
HttpPost post = new HttpPost(CAI3G_URL); | |
post.setHeader("SOAPAction","CAI3G#Create"); | |
post.setEntity(strEntity); | |
// Execute request | |
HttpResponse response = httpclient.execute(post); | |
HttpEntity respEntity = response.getEntity(); | |
if (respEntity != null) { | |
logger.info("Response:"); | |
logger.info(EntityUtils.toString(respEntity)); | |
} else { | |
logger.error("No Response"); | |
} | |
} | |
catch (Exception e) { | |
logger.error("Other exception = " + e.toString()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
operation name, should be able to find in your schema file.