开发者

How can I modify the incoming web service response in a JAX-WS client before it is parsed?

开发者 https://www.devze.com 2023-01-27 02:38 出处:网络
In a project, we have to call a web service that has exis开发者_如何学运维ted for many years and cannot be modified. This web service contains a bug: when it sends a response to a SOAP request, the re

In a project, we have to call a web service that has exis开发者_如何学运维ted for many years and cannot be modified. This web service contains a bug: when it sends a response to a SOAP request, the response does not always contain the required <S:Envelope> and <S:Body> elements.

How can we intercept the message and insert the missing parts before it is parsed by the JAX-WS SOAP parser?


I saw that this question was still open without any answers, so I'll provide some insight on how the problem was solved.

As it is, JAX-WS doesn't offer any support to do this kind of thing. It is probably possible to look into the details of the implementation and add a hook there, but then your solution is no longer portable to other web service container implementations.

Our final solution was to switch to Commons HTTP Client to send the message and receive the response. The messages themselves were created and parsed using plain JAXB. The SOAP headers were added and removed manually.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号