[英]@WebService jaxws - how to get namespace on method not soap envelope
I am trying to create a @WebService with java 8 and jax-ws. 我正在尝试使用Java 8和jax-ws创建一个@WebService。 However, I can't seem to find combination that will move the xmls " http://com.test.mymethod/mymethod " off of the envelope and onto the method. 但是,我似乎找不到找到将xmls“ http://com.test.mymethod/mymethod ”从信封移到方法上的组合。 Instead every method I try adds it to the Envbelope and then puts ser: prefix before the MyWebmethod. 相反,我尝试的每种方法都将其添加到Envbelope中,然后在MyWebmethod之前添加ser:前缀。 (which would be good if I was creating and sending out wsdl but I have to match request format already in use elsewhere) (如果我创建并发送wsdl,但是必须匹配其他地方已经使用的请求格式,那会很好)
desired request format: 所需的请求格式:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<MyWebmethod xmlns="http://com.test.mymethod/mymethod">
I think the only feasible way to to this (apart from asking: "Why is a semantically identical response not desired?" - but I am afraid of the answer :-) ) would be to "post-process" the response. 我认为解决此问题的唯一可行方法(除了问:“为什么不希望在语义上相同的响应?”-但我害怕答案:-))将是“后处理”响应。
The obvious solution would be to define a SOAPHandler
for the Service-Endpoint. 显而易见的解决方案是为服务端点定义一个SOAPHandler
。 This should be a straight-forward process: 这应该是一个简单的过程:
@Webservice
with a @HandlerChain
annotation. 用@HandlerChain
批注为@Webservice
批注。 That being said - I am not 100% positive that you will be able to sufficiently influence the output of the handler chain. 话虽这么说-我不是100%肯定您将能够充分影响处理程序链的输出。 There is a very real chance that the resulting textual representation after the application server has serialized your DOM is still non-satisfactory. 应用程序服务器对DOM进行序列化之后,最终的文本表示形式仍然很有可能无法令人满意。
The second option would be to define a ServletFilter
and have it rewrite the textual output of your webservice endpoint. 第二个选择是定义一个ServletFilter
并重写ServletFilter
端点的文本输出。 That will most certainly give you complete control over the output form - but at the (significant) cost of regenerating a DOM to feed into you XSL template. 无疑,这将使您完全控制输出表单-但以重新生成DOM并将其输入XSL模板的(显着)成本为代价。
All in all: Why would you go through all the pain? 总而言之: 您为什么要经历所有的痛苦? I am seriously curious. 我很好奇。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.