Below code explains how to change the web service end point through program.
ServiceRequestService
serviceRequestService = new ServiceRequestService(); ServiceRequestPortType
serviceRequestPortType = serviceRequestService.getServiceRequestPortType();
BindingProvider bp =
(BindingProvider)serviceRequestPortType; bp.getRequestContext().put(
BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
“http://localhost:9950/soa-infra/services/default/sr_v2/ServiceRequest.service”);
|
Here is the explanation for
this code.
this code.
- Get port object of the web service
- Type cast the port object to
BindingProvider object - BindingProvider class provides
a member method getRequestContext() which returns a map - This map holds all the
attributes of the request context - Overwrite end point with new
web service url which will replace the new end point with the old one.
Note: This code works only if the client style is RPC.
(Visited 1 times, 1 visits today)
No Comments