Search code examples
javaweb-servicesjax-ws

How to modify the XML of a WebMethod request generated by JAXWS


I have a weird problem: I have a central Web Service client that calls web methods on thousands of embedded Web Service servers. We recently discovered that the Web Service servers have a bug that make server crash if the XML request is exactly 0x4000 long. This does not happen very often, but with thousands of devices it happens every day, making the whole solution erratic.

The middle term solution is to fix the bug on the servers, but with thousands of firmware to flash this solution is not easy to deploy in few days.

The short term solution is to modify the XML request if it is exactly 0x4000 long and to pad it with a space character or something like that.

So, the XML is generated by JAX-WS (all classes were generated from Web Server manufacturer's WSDL), and I just call an interface annotated with @WebService with methods annotated with @WebMethod, @WebResult, ....

FYI: this the JAX-WS version.

/**
 * This class was generated by the JAX-WS RI.
 * JAX-WS RI 2.1.3-hudson-390-
 * Generated source version: 2.1
 * 
 */

My question is how can I tinker the XML generated by this call to check its length and modify it if needed?


Solution

  • You could use client-side SOAP Message Handlers to solve your problem. Check the following link: https://docs.oracle.com/cd/E21764_01/web.1111/e13734/handlers.htm