Search code examples
javaweb-servicessoapjax-ws

Is it possible to add parameters dynamically in jax-ws web-service?


I am exposing a jax-ws web-service to client with two parameter(say FirstName,LastName) initially.Say after some times we need to change the web service with 3 parameters(Say FirstName,LastName,FatherName), How do we add the new parameter without stopping the service(or server where the web server running).

I want to have the parameters in a property file(or in DB). If I add new parameter in that property file then the web-service needs to be updated.

Is it possible to add parameters dynamically in jax-ws web-service? please help. Thanks in advance


Solution

  • You cannot add the fields dynamically but you can use some approach to reach the same result.

    • Using a List of KeyValue object like interface argument, in this way the client will call the ws adding the keys/values needed.

    • Providing a ws where the input is a standalone xml so you will be able to unmarshal it and do what you need.

    Advantages: You have not to change your interface if a new field is added but only the backend.

    Disvantages: You have to check the key syntax to be sure of the reliability of the input.