I generated a web-service client using JBoss utils (JAX-WS compatible) using Eclipse 'web service client from a wsdl'.
So, the only thing I provided was a url to a web-service WSDL.
Now, the web service provider tells me to change the "url of client endpoint application access" of the web-service.
What is it and how to change it?
Use the WSDL to get the endpoint URL. The second option is to get the endpoint URL from the WSDL. ... URL newEndpoint = new URL("NEW_ENDPOINT_URL"); QName qname = new QName("http://ws.mycompany.tld","EchoService"); EchoService service = new EchoService(newEndpoint, qname); Echo port = service.
The actual endpoint URL that is contained in a published WSDL file consists of the prefix followed by the module's context-root and the web service url-pattern, for example, http:// myHost :9045/services/ myService .
A web service endpoint is an entity, processor, or resource that can be referenced and to which web services messages can be addressed. Endpoint references convey the information needed to address a web service endpoint. Clients need to know this information before they can access a service.
To change the service endpoint, you basically have two options. The first option is to change the BindingProvider.ENDPOINT_ADDRESS_PROPERTY property value of the BindingProvider (every proxy implements javax.xml.ws.BindingProvider interface): ...
The endpoints web method returns all records for IP address ranges and URLs that make up the Office 365 service. The latest data from the endpoints web method should always be used for network device configuration.
You can use BindingProvider.ENDPOINT_ADDRESS_PROPERTY to set the endpoint address in your client application code. //Create service and proxy from the generated Service class.
Parameters for the endpoints web method are: ServiceAreas=<Common | Exchange | SharePoint | Skype> — A comma-separated list of service areas. Valid items are Common, Exchange, SharePoint, and Skype. Because Common service area items are a prerequisite for all other service areas, the web service always includes them.
IMO, the provider is telling you to change the service endpoint (i.e. where to reach the web service), not the client endpoint (I don't understand what this could be). To change the service endpoint, you basically have two options.
The first option is to change the BindingProvider.ENDPOINT_ADDRESS_PROPERTY
property value of the BindingProvider
(every proxy implements javax.xml.ws.BindingProvider
interface):
... EchoService service = new EchoService(); Echo port = service.getEchoPort(); /* Set NEW Endpoint Location */ String endpointURL = "http://NEW_ENDPOINT_URL"; BindingProvider bp = (BindingProvider)port; bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL); System.out.println("Server said: " + echo.echo(args[0])); ...
The drawback is that this only works when the original WSDL is still accessible. Not recommended.
The second option is to get the endpoint URL from the WSDL.
... URL newEndpoint = new URL("NEW_ENDPOINT_URL"); QName qname = new QName("http://ws.mycompany.tld","EchoService"); EchoService service = new EchoService(newEndpoint, qname); Echo port = service.getEchoPort(); System.out.println("Server said: " + echo.echo(args[0])); ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With