在 JAX-WS Web 服务方法中获取原始 XML 参数
如何实现类似的目标:
@WebService(endpointInterface = "ru.citc.techtest.cxfconcepts.HelloWorld")
public class HelloWorldImpl implements HelloWorld {
public String sayHi(DOMSource xml) {
return "Hello";
}
}
我需要一个原始 XML 进行处理(SAX 或 DOM)。同时我想利用 JAX-WS 的现有方法路由。(我使用 Apache CXF) 返回值可以是任意类型。
How to achieve something like that:
@WebService(endpointInterface = "ru.citc.techtest.cxfconcepts.HelloWorld")
public class HelloWorldImpl implements HelloWorld {
public String sayHi(DOMSource xml) {
return "Hello";
}
}
I need a raw XML for processing (SAX or DOM). In same time I want to leverage existing method routing of JAX-WS.(I use Apache CXF)
Returned value may be any type.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信这会起作用:
默认情况下,您应该获得一个 StaxSource(它是 SAXSource 的子类),以便您可以将其传递到 XML 处理库等中。您可以返回 Source 的任何子类。但是,您也可以更具体地使用:
如果您知道需要将其作为 DOM。我实际上认为:
也可以。
I believe this will work:
By default, you should get a StaxSource (which is a subclass of SAXSource) so you can pass that into your XML processing library and such. You can return any subclass of Source. However, you can also be more specific and use:
if you know you need it as a DOM. I actually think:
would work as well.