Skip to main content

Adding SOAP Headers for JAX-WS Client

After trying various options none seem to be apt. I could add the Headers using this JAX-WS approach.

wsimport -keep -verbose -XadditionalHeaders https:// Your Web Service.asmx? WSDL

When You generate the WebService Clients using "XadditionalHeaders" option, it will create the web service methods with the Header as another Parameter, which You can populating using the values You have.

I could not find a better option than this. Other Approaches I tried were - Adding a JAX-WS ClientHandler class ,and using a SAAJ client altogether. Reference - JAXWS Implementation.


https://jcp.org/en/jsr/detail?id=224

Comments

Popular posts from this blog

Java Productivity tools

Here are the list of Java Productivity tools that help in simplifying the daily life of a developer. Eclipse as an IDE simplifies the development life cycle which has a lots of plugins to support different programming languages and frameworks. Some of useful Eclipse plugins are - Sonarlint that helps to do static code analysis and give suggestions as we go along the development life cycle. JDGUI - Is the Eclipse Plugin that supports the decompilation of the Java application within eclipse, this is very handy when debugging and need to look at the out of the box code from a framework/library. JUnit is the unit testing framework that supports Unit Testing of Java Applications. Mockito is the framework that supports the Mock Unit Testing of the Java Application.