Saturday, November 5, 2016

SOAP Event Source Activity | Creating 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.

There are three major SOAP activities which are involved while creating web service by using SOAP Event Source are as follows:

SOAP Event Source: The SOAP Event Source process starter creates a process instance for incoming SOAP requests. SOAP is a standard protocol for invoking web services. This allows you to create a web service using process definitions.

SOAP Send Reply: The SOAP Send Reply activity sends a reply to an application that sent a SOAP request. This activity is primarily used in process definitions that implement web services. When SOAP Event Source is used as the process starter, the SOAP Send Reply activity is used to send the reply to the request that starts the process instance.

SOAP Send Fault: The SOAP Send Fault activity sends a SOAP fault to the client if an error occurs during processing of a SOAP request.

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 SOAP Event Source:

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 : Create a process definition that performs the work of the web service. Use the SOAP Event Source process starter for this process definition. Use the SOAP Send Reply activity to return a reply or the SOAP Send Fault activity to return a fault to the client.

  • SOAPEventSource configuration tab, browse for abstract WSDL defined in earlier STEP-3 and select ConcatOperation as operation to implement.
  • Update Transport by browsing for transport created in STEP-2.
  • ConcatData mapper activity is defined to concat both the input strings and to generate concatenated string as output.
  • SOAPSendReply sends the concatenated string as response
  • SOAPSendFault generates fault message if in case of any error/issue.

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

As shown below, navigate to SOAPEventSource activity WSDL Source tab and save the WSDL Source (represents Concrete WSDL) with .wsdl as file extension and share it with clients.

NOTE : In real time, We create a process definition that retrieves the concrete WSDL file and sends it to web service clients. Use the HTTP Receiver process starter and the Retrieve Resources activity for this process definition.

For more info, you can check here How To retrieve Concrete WSDL using RetrieveResoureces Activity.

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 the SESProcess created in STEP-4.
  • Fire the request by providing input request data, SESProcess will be triggered and executed and sends response back to client.

No comments:

Post a Comment

back to top