Skip to main content

Lookup one endpoint for a given service

Lookup only one endpoint for the given service which has been registered on the Service Locator server.

Parameters: fully qualified service name, required user defined properties (optional).

Return: one WS-Addressing EPR, for an endpoint that provides the service and fulfills the required properties. If several endpoints match, select one randomly. If none exists, return business fault.

The Lookup one endpoint for given Service operation is described in LocatorService.wsdl as follows:

<operation name="lookupEndpoint">
   <input message="lps:lookupEndpointInput"/>
   <output message="lps:lookupEndpointOutput"/>
   <fault name="InterruptedExceptionFault"
      message="lps:InterruptedExceptionFault"/>
   <fault name="ServiceLocatorFault" message="lps:ServiceLocatorFault"/>
</operation>
<message name="lookupEndpointInput">
   <part name="parameters" element="lpx:lookupEndpoint"/>
</message>
<message name="lookupEndpointOutput">
   <part name="parameters" element="lpx:lookupEndpointResponse"/>
</message>

The related message type definition is separately described in locator-soap-types.xsd and locator-common-types.xsd as follows:

<xsd:element name="lookupEndpoint" type="lpx:lookupRequestType"/>
<xsd:element name="lookupEndpointResponse">
<xsd:complexType>
   <xsd:sequence>
      <xsd:element name="value" type="wsa:EndpointReferenceType"/>
   </xsd:sequence>
</xsd:complexType>
</xsd:element>

Example of Lookup endpoint for the given service provided in project /examples/talend/tesb/locator-service/soap-service/client/:

Example of simple locator service configuration you can see in /examples/talend/tesb/locator-service/soap-service/client/src/main/filtered-resources/META-INF/client.xml:

<jaxws:client id="locatorService" 
       address="http://localhost:8040/services/ServiceLocatorService"
       serviceClass="org.talend.services.esb.locator.v1.LocatorService"
</jaxws:client>

Example how to lookup endpoint using this configuration you can see in/examples/talend/tesb/locator-service/soap-service/client/src/main/java/demo/client/Client.java:

ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("/META-INF/client.xml");
LocatorService client = (LocatorService) context.getBean("locatorService");

W3CEndpointReference endpointReference = client.lookupEndpoint(new QName("http://talend.org/esb/examples/", "GreeterService"), null);
System.out.println(endpointReference.toString());

javax.xml.ws.Service jaxwsServiceObject = Service.create(new QName("http://talend.org/esb/examples/", "GreeterService"));
	
Greeter greeterProxy = jaxwsServiceObject.getPort(endpointReference, Greeter.class);
String reply = greeterProxy.greetMe("HI");
System.out.println("Server said: " + reply);

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!