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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With