Sunday, September 6, 2020

SOAP - setting service end point (target url) run time

Suppose you are the client and you are consuming SOAP service. There will be a possible scenario when you need to change / set  the SOAP server end point URL at run time when you are just to call the service.

We can achieve this using BindingProvider.ENDPOINT_ADDRESS_PROPERTY

We need to add the following code snippet just befor to call the SOAP service.

UserService_Service service = new UserService_Service();

UserService proxy = service.getUserService();

((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "target-end-point-url");


Note : UserService is a stub service interface created by wsdl.

            UserService_Service is a stub service implementation class created by wsdl.

    

Labels: ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home