SayHello consumer - 6.1

Talend ESB Getting Started Guide

Talend ESB
Design and Development
Talend Studio

In this section, you will see how to create the SayHello consumer, and call the service with it.

Creating the SayHello consumer

  1. To test the service, you can also create a small consumer Job. Right-click Job Designs and select Create Job. In the Name field, type SayHelloConsumer, and the purpose is Demo. Click Finish.

  2. Now in the [Job SayHelloConsumer 0.1] tab, search for tFixedFlowInput in the palette, and drag and drop it onto the grid. Similarly, drag and drop tXMLMap, tESBConsumer, and tLogRow (twice) as shown below.

    The tFixedFlowInput components generates as many lines and columns as you want using context variables, and the tESBConsumer calls a specified method from the invoked Web service, and returns a class, based on parameters.

  3. Now configure the components. Double-click the center of tFixedFlowInput_1 and in Component tab below, select Use Inline Table. Then click the [...] button next to Edit schema to open the Schema editing window.

    In this window, click [+] to add a string argument, and rename newColumn to Name and click OK to close this window.

  4. Returning to the tFixedFlowInput_1 Component tab, use the [+] button to add sample rows, and successively replace the "newLine" text with names "Peter", "Alice" and "Bob".

    This is the example data that the consumer will send to the SayHelloService.

  5. Now, in the Job SayHelloConsumer 0.1 Job, link the components as before, by right-clicking and dragging tFixedFlowInput_1 > row > main to tXMLMap_1. Then right-click tXMLMap_1 > row and name this new Output Request (click the default yes to get the schema of the target component), and drop the end on tESBConsumer_1.

  6. Now double-click the tXMLMap to configure it as before. On the right hand side, click payload > Import From Repository. In the [Metadata] wizard that appears navigate from File XML to SayHelloServiceOperationRequest 0.1, and select it. This enables you to call the service operation. Click OK.

  7. Now left-click and drag Name on the left hand side to the in parameter on the right hand side and click OK to return to the main window.

  8. Finally, take care of the response outputs. Right-click the center of tESBConsumer_1, drag and select Row > Response and drop the end on tLogRow_1 so that any responses should go there. Similarly, right-click tESBConsumer_1, select Row > fault and drop the end on tLogRow_2 so that any faults should go there.

    Now, the consumer Job configuration is complete.

    In summary, tFixedFlowInput generates "Peter", "Alice", "Bob", these will be passed by tXMLMap to tESBConsumer, which will do three corresponding invocations on the target provider.

Running the consumer

  1. Now, point the consumer at the correct WSDL endpoint for the Service. So go to the Component tab of the tESBConsumer component, and edit the endpoint there to reference the correct service. Click the [...] button next to Service Configuration, and the WSDL configuration window opens. Paste in "http://localhost:8090/services/SayHelloService" to replace the service address there, giving a full address of "http://localhost:8090/services/SayHelloService?WSDL" and click the refresh button to the right to load the information. Click Finish.

  2. Finally, run the consumer Job. Click the Run (Job SayHelloConsumer) tab, and click Run. The Job builds and executes, and the three names in a Hello message display in the output.

So, the creation and execution of a SayHello consumer and provider in Talend Studio is successful.