Saturday, November 5, 2016

Service Activity | Implementing SOAP Web Service in TIBCO BW


     There are two approaches to implement web services as a web service provider in TIBCO ActiveMatrix BusinessWorks.

  1. By using SOAP Event Source process starter Activity
  2. By using Service Activity

   The “SOAP Event Source” process starter creates a simple service with one operation over one transport but whereas the “Service” resource allows you to create a service that implements multiple operations offered over multiple transports.

   At runtime, a client can retrieve the WSDL file for a process containing this process starter using an HTTP request. Once the WSDL file is retrieved, the client can perform a SOAP request to invoke the web service.

Service : A Service shared configuration resource describes an interface and its associated operations. This also specifies a set of endpoint bindings that expose the service to potential clients over specific transports.

Consider a scenario, here we are going to implement a web service with single operation which takes two input string values as request and sends output as concatenated string of these two input parameters.

Below are the steps which are involved in creating the web service by using Service activity:

STEP -1 : Create the XSDs to define the input, output and fault messages for the web service.

STEP -2 : Define Transport(HTTP/JMS)

Here we are using HTTP connection and configuration is updated for Host(localhost) and Port(7369).

STEP -3 : Create an abstract WSDL file resource that defines the interface to the web service.

   WSDL defines the interface for the service. This interface describes the operations contained in the service and input, output and fault messages for the operations. As shown below, we created an abstract WSDL which defines single operation(ConcatOperation) and its respective input, output and fault messages.

STEP -4 : Define/Configure the Service activity with required configuration details as below:

  • WSDL file - This defines the interface for the service.
  • Endpoint bindings - endpoints expose the location of the service to the service partner. An endpoint binding specifies the transport to use for the endpoint, any transport-specific properties and any SOAP details (such as SOAP version, SOAP action and so on).
  • Operation Implementation - each operation must specify the process definition to execute for the operation.

   Here in TIBCO BW we can generate web service either from WSDL (or) from Process. So, we will make use of abstract WSDL defined in previous step to generate the web service as below.

  • Right click on abstract WSDL and click on Tools or Multi-User --> Generate Web Service --> From WSDL
  • provide the required configuration like location of service and operation implementation process and also transport to be used for web service and then click on Generate.
  • Then it generates the Service and Implementation Processes respective to each operation defined in abstract WSDL(in our case, we defined only single operation so single process will be generated.)
  • Check the generated Service, It will be configured with WSDL, Endpoint bindings and Operation implementation.
  • In Service Configuration --> Endpoint Bindings --> According to requirement change the Endpoint URI and Soap Action details.
     In our case, I changed Endpoint URI to /BusinessProcesses/ConcatinationService/ConcatOperation  and Soap Action to ConcatOperation.
  • Implement the business functionality in operation implementation process, In our case, we have concatenated both the input values(FirstName and LastName) and passed it to output value(FullName).

STEP -5 : Share the concrete WSDL to web service clients.

As shown below, Navigate to Service activity WSDL Source tab and Save WSDL Source (represents Concrete WSDL) with .wsdl as file extension and share it with clients.

STEP -6 : Test the web service by using concrete WSDL and anyone of web service client/testing tool, here we used SOAP UI as web service testing tool.

  • Create New SOAP project and provide concrete WSDL as input.
  • In Designer Tester, load only the Service agent(Concatination-Service) created in STEP-4.
  • Fire the request by providing input request data, business process specific to operation will be executed and send response back to client.



No comments:

Post a Comment

back to top