Tom Donohue Tom Donohue

How to create a SOAP service in Talend

This Talend SOAP tutorial will show you how to create a SOAP web service in Talend ESB.

What is a Service in Talend ESB?

In Talend ESB, a (Web) Service consists of a WSDL file, and an assigned Job. Services themselves do not contain any logic, but are instead wrappers for Jobs, where the logic is implemented.

A Job that will be exposed as a Service uses an tESBProviderRequest component to receive the web service request, and the tESBProviderResponse component to return the response to the consumer. Logic is typically placed between these two components – for example, to validate and save a new customer record.

The following steps describe how to create a simple synchronous (request-response) web service in Talend Open Studio for ESB.

Talend SOAP tutorial - creating a Job to expose as a Service

You can create the Job before you create a Service, or you can have Talend create a Job for you automatically. I prefer to create the Job first. The most simple example of a Job that can be exposed as a Service in Talend ESB looks like the following:

Basic Talend ESB Job
Basic Talend ESB job

This is a simple Talend Job consisting of:

  1. A tESBProviderRequest component
  2. A tESBProviderResponse component
  3. A wire connecting the Request to the Response (right-click the tESBProviderRequest icon and drag to the tESBProviderResponse component to make the connection).

At this stage we don’t need to worry about any processing logic. Our service will simply echo a response back to the consumer.

Create a simple Job and ensure it is saved before continuing.

To create the Service and assign the Job

  1. In the Repository, right-click the Services node and choose Create Service.

    Creating a service in the Repository tree

  2. In the New Service dialogue box, enter in some basic details about the service (Name, Purpose, Description) and click Next.

    New Service properties

  3. On the Assign WSDL page, select Create new WSDL and click Finish.

    Assign WSDL

  4. The WSDL editor is displayed:

    WSDL Editor

  5. Click the grey arrows by each message (input, output) to enter the schema editor, where you can customise each message structure. Here we have customised the input message to contain two elements, greeting and name:

    Echo Service input message definition

  6. Once you have customised the message structures, find the web service operation in the Repository tree (find the Service you created, and then expand all child nodes until the operation is displayed). Right-click the operation name and choose Assign Job.

  7. Choose Create a new Job and Assign it to this Service Operation.

    Assign Job to Service

  8. On the next step, select the Job you created above and click Finish.

    Select Job to Assign

  9. Now locate your job in the Repository tree (you can double-click either the Job or the Service) and click Run. The following output will be displayed in the Console:

    > web service [endpoint: http://localhost:8090/services/EchoService] published</pre>
    
  10. In your web browser, navigate to http://localhost:8090/services/EchoService?WSDL. This will display the web service’s WSDL. The web service is now deployed.

Using the WSDL location given in the final step, you can now consume this service from any other application that supports SOAP services.


I hope you’ve enjoyed this Talend SOAP tutorial. If you’ve found it useful, please share! And if you have any thoughts, please post your feedback in the comments below.

Comments

What do you think? You can use Markdown in your comment.

To write code, indent each line with 4 spaces. Or, to paste a lot of code, you can put it in pastebin.com and share the link in your comment.