Register an endpoint - 7.1

Talend ESB Infrastructure Services Configuration Guide

EnrichVersion
7.1
EnrichProdName
Talend Data Fabric
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for ESB
Talend Real-Time Big Data Platform
EnrichPlatform
Talend ESB
Talend Runtime
task
Design and Development
Installation and Upgrade

For a specific service, register an endpoint on the Service Locator server, so the user can access this endpoint through the service locator server.

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

Return: void

The Register an endpoint operation is described in LocatorService.wsdl as follows:

<operation name="registerEndpoint">
   <input message="lps:registerEndpointInput"/>
   <output message="lps:registerEndpointOutput"/>
   <fault name="InterruptedExceptionFault"
      message="lps:InterruptedExceptionFault"/>
   <fault name="ServiceLocatorFault" message="lps:ServiceLocatorFault"/>
</operation>
<message name="registerEndpointInput">
   <part name="parameters" element="lpx:registerEndpoint"/>
</message>
<message name="registerEndpointOutput">
   <part name="parameters" element="lpx:registerEndpointResponse"/>
</message>

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

<xsd:element name="registerEndpoint">
<xsd:complexType>
   <xsd:sequence>
      <xsd:element name="serviceName" type="xsd:QName"/>
      <xsd:element name="endpointURL" type="xsd:anyURI"/>
      <xsd:element name="binding" type="lpx:BindingType" />
      <xsd:element name="transport" type="lpx:TransportType" />
      <xsd:element name="properties" type="lpx:SLPropertiesType"
                   minOccurs="0" maxOccurs="1"/>
   </xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="registerEndpointResponse">
<xsd:complexType>
   <xsd:sequence/>
</xsd:complexType>
</xsd:element>
<xsd:simpleType name="BindingType">
   <xsd:restriction base="xsd:string">
      <xsd:enumeration value="SOAP11" />
      <xsd:enumeration value="SOAP12" />
      <xsd:enumeration value="JAXRS" />
      <xsd:enumeration value="OTHER" />
   </xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="TransportType">
   <xsd:restriction base="xsd:string">
      <xsd:enumeration value="HTTP" />
      <xsd:enumeration value="HTTPS" />
      <xsd:enumeration value="JMS" />
      <xsd:enumeration value="OTHER" />
   </xsd:restriction>
</xsd:simpleType>

An example of registering an endpoint for a specific service is provided in the project /examples/talend/tesb/locator-service/soap-service/war/:

An example of simple locator service configuration is in /examples/talend/tesb/locator-service/soap-service/war/src/main/resources/client.xml:

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

An example of how to register an endpoint using this configuration is in/examples/talend/tesb/locator-service/soap-service/war/src/main/java/demo/service/ContextListener.java:

ClassPathXmlApplicationContext context = 
    new ClassPathXmlApplicationContext ("/client.xml");
LocatorService client = 
    (LocatorService) context.getBean("locatorService");
String serviceHost = "localhost:";

try {
    client.registerEndpoint(new QName(
        "http://talend.org/esb/examples/", "GreeterService"),
        serviceHost, BindingType.SOAP_11, TransportType.HTTP, null);
    } catch (InterruptedExceptionFault e) {
                e.printStackTrace();
    } catch (ServiceLocatorFault e) {
                e.printStackTrace();
}