将 xml 文档(作为参数?)传递给 Web 服务
我正在用java和Metro开发一个Web服务,需要传递大量信息。例如,类似 xml 的内容描述了客户的所有属性。
我想知道是否有某种标准方法可以在文档中传递数据。目前,我一直将数据作为名为“customerXML”的字符串参数传递。
任何建议表示赞赏。仅供参考,我使用 RestEasy 定义了另一个宁静的 ws,它在使用输入/输出流时效果很好,但我正在寻找一种利用基于肥皂的 Web 服务来公开类似功能的方法。
I am developing a web service in java and Metro that requires a lot of information to be passed. For example, something like xml describing all the attributes of a customer.
I am wondering if there is some standard way in which to pass the data in a document. Currently I have been passing the data as a string parameter named 'customerXML'.
Any suggestions appreciated. FYI I have defined another restful ws using RestEasy which works great using input/output streams, but am looking for a way to leverage soap-based web services to expose similar functionality.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
JAX WS 非常适合此要求,它适用于 SOAP
JAX WS is perfect for this requirement, It works on SOAP
我的假设是,没有一种标准方法可以将 xml 文档传递到基于 SOAP 的 Web 服务,而无需您自己编码整个 SOAP 消息。因此,我认为没有一种简单的方法可以做到这一点,这也是 RESTful Web 服务获得认可的原因之一。使用基于 SOAP 的 Web 服务执行此操作的最佳方法是将文档作为字符串参数传递,并在服务器代码中进行验证/解析。
My hypothesis is that there isn't a standard way to pass xml documents to a soap-based web service without coding the entire SOAP message yourself. Hence I do not think there is an easy way to do so and one reason why RESTful web services are gaining acceptance. The best way to do it using SOAP based web services is to pass the document as a string parameter and validate/parse within your server code.