我使用wsimport
生成了web服务类,现在我需要发送一个XML请求(给定特定格式)到这个WebService,它将返回一个XML响应,然后我可以在我的端上使用该XML响应。如何创建这个自定义的XML请求,我应该发送到WebService?是否有任何相关文档可供参考?
我使用wsimport
生成了web服务类,现在我需要发送一个XML请求(给定特定格式)到这个WebService,它将返回一个XML响应,然后我可以在我的端上使用该XML响应。如何创建这个自定义的XML请求,我应该发送到WebService?是否有任何相关文档可供参考?
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.
new NameValuePair("param", "my xml string")
- thiagoh