Reputation: 3337
I have some limitations in using generated stubs with the 3rd party software. SO, I am looking for other options like simple HTTP request and response to get the result. I will probably need to pass 5 or 6 parameters to one operation and get one output from the web service.
I can create a simple JSP file, which internally calls the webservice. I can call this JSP via HTTP Request. I want to check if there are any other options.
I am using JDK1.6, JBoss 5.1.
Upvotes: 2
Views: 14256
Reputation: 340923
SOAP web service requests are normal POST HTTP requests which you can trigger using any client, including simple URLConnection
or even curl
. See: Sending a SOAP request to a Web Service via URLConnection.
You don't need a JSP (in fact, calling external web services from JSP is a terrible idea from maintenance perspective). You can call web services from any Java code, even directly from main
method.
Upvotes: 6
Reputation: 2666
I agree with Tomasz Nurkiewicz. Do not use a JSP to call the web service.
Instead, create a web service that calls the other web service you need. This way you can easily work with the result before sending back the response.
Web services can be easily created on JBoss using annotations.
Upvotes: 0
Reputation: 33544
Try this out...
public void postData() throws Exception {
HttpClient client = new DefaultHttpClient();
HttpPost httppost = new HttpPost("https://www.xyz.com");
List<NameValuePair> list = new ArrayList<NameValuePair>(1);
list.add(new BasicNameValuePair("name","ABC");
httppost.setEntity(new UrlEncodedFormEntity(list));
HttpResponse r = client.execute(httppost);
}
Upvotes: 1