支持在 HttpUnit 中发布 XML?
HttpUnit 是否支持使用 xml 参数从 HTTP POST 获取响应?
编辑
如果您想发送 POST 请求,您可以实例化一个 PostMethodWebRequest 对象。
WebRequest request = new PostMethodWebRequest("http://example.com/thing/create");
如果您想为该请求设置参数,我认为您会做的是这样的:
request.setParameter("attribute", "value");
但我正在寻找的是如何使帖子的正文成为XML 文档包含创建新事物所需的所有属性的数据。有谁知道实现这一目标的最佳方法?
Does HttpUnit support getting a response from an HTTP POST with an xml argument?
Edit
If you want to send a post request, you might instantiate a PostMethodWebRequest object.
WebRequest request = new PostMethodWebRequest("http://example.com/thing/create");
And if you want to set parameters for that request, I think what you would do is this:
request.setParameter("attribute", "value");
But what I am looking for is how to make the body of the post an XML document that holds the data for all the attributes I need to create a new Thing. Does anyone know the best way to accomplish that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这似乎可以解决问题:
This seems to do the trick: