Reputation: 10594
I have generated web service classes by using wsimport
and now I am supposed to send a XML request (particular format given) to this webservice which return a XML response and then I can use that XML response on my side. How do you create this custom XML request which I am supposed to send to webservice. Any documentation available there?
Upvotes: 3
Views: 9965
Reputation: 7408
There is a lot of ways to do that..
one of them is using HttpClient from Apache and executing a POST like this
PostMethod post = new PostMethod("http://jakarata.apache.org/");
NameValuePair[] data = {
new NameValuePair("user", "joe"),
new NameValuePair("password", "bloggs")
};
post.setRequestBody(data);
post.setRequestHeader("Content-type", "application/xhtml+xml");
// execute method and handle any error responses.
...
InputStream in = post.getResponseBodyAsStream();
// handle response.
Upvotes: 3