After writing complete step by step tutorials on developing SOAP Over HTTP and SOAP over JMS web services in TIBCO; I am now going to write this step by step tutorial in which I will explain how to expose a TIBCO BW process as a web service operation using SOAP Palette activities like SOAP Event Source, SOAP Send Reply and SOAP Send Fault.
For explaining the usage of SOAP Palette activities, I am going to take a simple scenario for this step by step tutorial. In this example, I will create a web service operation GetPayInfo which will be taking EmployeeID as an input and will return Payroll details (PayStatus and PayDate) as a response. To keep the things simple, I am not implementing any database part and the response will be sent by hard coding the values in the process instead.
Let’s now proceed step by step with the tutorial on using SOAP Event Source to expose a process as web service:
Step 1: Create HTTP Connection in your TIBCO Project
The web service that we are going to develop will use HTTP as a transport. So the first thing that we need to do is to create a new HTTP Connection by using HTTP Palette. Drag HTTP Connection resource in your project and configure it by specifying host and port. The configurations made by me for the HTTP Connection are shown in below screenshot:
Step 2: Create XML Schema for Input and Output of the Web Service Operation
Before we create an abstract WSDL, we need to have a Schema in which all input and output parameters will be specified. In our case, the schema is simple having EmployeeID as an input while PayStatus and PayDate as output. Schema can be seen in the screenshot below:
Step 3: Create Abstract WSDL
Abstract WSDL contains all details about a web service including Its operations, WSDL messages and their parameters. For our example scenario, we create a WSDL by dragging WSDL resource into our project. I named it as PayrollAbstractWSDL.
Double click on the WSDL and then add WSDL Messages for Request, Response and Fault. These WSDL messages will refer to the XSD Elements that we created in previous step. We also add PortType for our web service here.
WSDL Messages and PortType will look like below (I am showing configuration part of only one message. Follow the same to configure other two messages):
Double Click on the PayrollPortType and then add Operation. I named the operation as GetPayInfo. In the configuration of the operation, add Input, Output and Fault Messages in the Message Table as shown below:
Now we are done with this step of creating Abstract WSDL for our web service.
Step 4: Create a BW Process using SOAP Palette and Expose as a Web Service
Create a new process in your project. In the proess, drag SOAPEventSource so that It becomes your process starter activity. In the configuration of SOAP Event Source activity, choose the Abstract WSDL, Its operation and the HTTP transport as you can see in the screenshot below:
Now if you go to WSDL Source tab, you will find Concrete WSDL which has all the details of the service including its transport. Save this concrete WSDL as it will be used by the client to consume the web service.
In order to send a reply back to the consumer from the web service operation, add SOAPSendReply activity in the process. In the configuration tab of this activity, choose SOAPEventSource in the Reply To drop down.
In the Input tab of this activity, I am just hard coding the response values. In real time scenarios, this information will be fetched from database or some other source.
The input tab in my case is shown in the screenshot below:
To cater for exception scenarios and to send a Fault Message as a response, I have added a Catch activity which will catch all types of exceptions. Then next to catch activity, I have used SOAPSendFault activity which is used to send back a Fault response from a web service operation.
Input mapping of SOAP Send Fault activity is shown in below screenshot:
Now we are done with all the development steps of our web service. Let’s proceed with the testing part of the tutorial.
Step 5: Test SOAP Web Service using SOAP UI
You can consume your web service with any SOAP client. I am going to use SOAP UI tool for testing my web service.
By using the Concrete WSDL that was saved in previous step, I have sent a request to the web service and you can see in below screenshot that I have received back a response: