Developing Web-Services With TIBCO ActiveMatrix BusinessWorks _ FishEyeView

15
9/13/2014 Developing Web-Services with TIBCO ActiveMatrix BusinessWorks | FishEyeView http://fisheyefocus.com/fisheyeview/?p=146 1/15 FishEyeView The world as seen by a fish… another blog by Azahar Machwe « Structure of a Web-Services Description Language (WSDL) Document Creating a WSDL resource retriever for Service Resource » Developing Web-Services with TIBCO ActiveMatrix BusinessWorks In this post we are going to talk about developing web-services in TIBCO ActiveMatrix BusinessWorks (AMBW). We will be using the following software: 1) TIBCO Designer 5.6 to develop and test-deploy the web-service 2) SOAP-UI 3.0.1 (Freeware) to test the web-service We are going to be looking at web-service development from a conceptual point of view rather than concentrating on specific implementations. The TIBCO AMBW Process Design Guide and the Palette Reference do an excellent job of describing web-service implementations. Before we get into web-service development in TIBCO AMBW let us just review what goes into developing a web-service. As there are many excellent books on web-services out there this section will be restricted to a brief overview. A web-service consists of three basic components: 1. Description – all the information about the web-service, including how to invoke it. 2. Protocol – how to communicate with the web-service. 3. Implementation – how to implement the operations defined by the web-service. The Description of a web-service needs to address both, the abstract interface as well as its concrete implementation. As we all know this description is contained in the WSDL file associated with the web- service. With modern tools it is very easy to create client stubs for web-services using just the WSDL. The WSDL also acts as a contract between the service provider and the consumer. Therefore a skeleton of the web-service implementation can also be created using just the WSDL. This approach towards service development is called the ‘contract-first’ approach where you define the interface before defining the implementation. The opposite of the above process i.e. ‘implementation-first’ approach allows easy exposure of existing functionality as a web-service. TIBCO AMBW allows for both styles of web-service development.

description

a

Transcript of Developing Web-Services With TIBCO ActiveMatrix BusinessWorks _ FishEyeView

Page 1: Developing Web-Services With TIBCO ActiveMatrix BusinessWorks _ FishEyeView

9/13/2014 Developing Web-Services with TIBCO ActiveMatrix BusinessWorks | FishEyeView

http://fisheyefocus.com/fisheyeview/?p=146 1/15

FishEyeViewThe world as seen by a fish… another blog by Azahar Machwe

« Structure of a Web-Services Description Language (WSDL) DocumentCreating a WSDL resource retriever for Service Resource »

Developing Web-Services with TIBCO ActiveMatrixBusinessWorks

In this post we are going to talk about developing web-services in TIBCO ActiveMatrix BusinessWorks(AMBW). We will be using the following software:

1) TIBCO Designer 5.6 to develop and test-deploy the web-service

2) SOAP-UI 3.0.1 (Freeware) to test the web-service

We are going to be looking at web-service development from a conceptual point of view rather thanconcentrating on specific implementations.

The TIBCO AMBW Process Design Guide and the Palette Reference do an excellent job of describingweb-service implementations.

Before we get into web-service development in TIBCO AMBW let us just review what goes intodeveloping a web-service. As there are many excellent books on web-services out there this section willbe restricted to a brief overview.

A web-service consists of three basic components:

1. Description – all the information about the web-service, including how to invoke it.2. Protocol – how to communicate with the web-service.3. Implementation – how to implement the operations defined by the web-service.

The Description of a web-service needs to address both, the abstract interface as well as its concreteimplementation. As we all know this description is contained in the WSDL file associated with the web-service. With modern tools it is very easy to create client stubs for web-services using just the WSDL.

The WSDL also acts as a contract between the service provider and the consumer. Therefore a skeletonof the web-service implementation can also be created using just the WSDL. This approach towardsservice development is called the ‘contract-first’ approach where you define the interface before definingthe implementation.

The opposite of the above process i.e. ‘implementation-first’ approach allows easy exposure of existingfunctionality as a web-service.

TIBCO AMBW allows for both styles of web-service development.

Page 2: Developing Web-Services With TIBCO ActiveMatrix BusinessWorks _ FishEyeView

9/13/2014 Developing Web-Services with TIBCO ActiveMatrix BusinessWorks | FishEyeView

http://fisheyefocus.com/fisheyeview/?p=146 2/15

Before we go any further it will help to review the structure of a WSDL document.

There are two ways of implementing a web-service in TIBCO AMBW:

1) Service Resource

2) SOAP Event Source process starter

Which route you take depends on your specific requirements as well as the current state of development.

You would ideally use a SOAP Event Source process starter to expose a single process as a web-serviceover a single transport protocol. In case you need to expose multiple processes over multiple transportprotocols and have a clean separation between web-service definition and implementation, use theService Resource.

I will first focus on using the Service Resource as it (in my opinion) is a cleaner way of doing things andconforms well to the philosophy behind web-services of separation of interface and implementation.

SOAP Event Source will be covered in another post.

Now from the TIBCO AMBW Process Design Guide we have:

“A service joins an abstract WSDL interface to a concrete implementation and exposes them on one ormore endpoints”

There are three main steps in setting up a web-service using the Service Resource:

1) Define the service interface using the WSDL and Schema Resource – involves definition of theabstract part of the WSDL as well as defining schema for input and output data using the SchemaResource

2) Setup the endpoint bindings to expose the service.

3) Implement the operations defined in the web-service.

Figure 1 shows the mapping between TIBCO AMBW components and various components of a web-service (as represented in the WSDL).

Page 3: Developing Web-Services With TIBCO ActiveMatrix BusinessWorks _ FishEyeView

9/13/2014 Developing Web-Services with TIBCO ActiveMatrix BusinessWorks | FishEyeView

http://fisheyefocus.com/fisheyeview/?p=146 3/15

Figure 1: Mapping between TIBCO AMBW components and various components of a web-service.

Request Context

As the Service Resource separates the service definition from the implementation, there might be arequirement to access the ‘context’ of the request by the implementing process. This ‘context’ could bethe client’s digital signature (for authentication) or something simpler like a client ID. The ContextResource allows us to do just this. We can define a schema to store the relevant ‘context’ which can thenbe accessed by the implementing process using the GetContext and SetContext activities.

Example

I will take the example of a simple web-service for Customer Information Management (add and retrievecustomer information). The web-service will contain two operations:

1. Add Customer Information (name, age and ID).2. Retrieve Customer Information using Customer ID with a Request ID for logging purposes.

To get the customer information we supply the customer ID and a request ID to the web-service whichwill return the customer information.

To add information for a new customer we will supply the customer information (id, name and age).

Page 4: Developing Web-Services With TIBCO ActiveMatrix BusinessWorks _ FishEyeView

9/13/2014 Developing Web-Services with TIBCO ActiveMatrix BusinessWorks | FishEyeView

http://fisheyefocus.com/fisheyeview/?p=146 4/15

Going back to the three step process for implementing a web-service using the Service Resource:

Step 1: Defining the web-service interface

We will use the Schema Resource and the WSDL Resource to define the web-service interface includingthe operations and the associated input/output schema.

The Schema

Firstly create the Schema for the input and output messages using the Schema Resource (within the XMLmenu).

Below we can see a simple CustomerInformation schema which defines the customer informationstructure (for both retrieval and addition) as well as a CustomerInformationRequest schema whichdefines the structure of the incoming request for customer information.

The Web-service Interface using WSDL

Next we define the interface for the web-service using the schema we defined above and a WSDLresource.

We will first define the input and output messages using the schema and then use them to define theoperations. All the required resources are in the WSDL menu.

Create a new WSDL resource and double-click it. Add two new Messages: CustomerInformationRequestand CustomerInformation. The output message for the retrieve information operation has the sameschema as the input for the add information operation.

Next we define the operations using previously defined Messages. Add a PortType resource to startdefining operations. Double click the PortType resource and add two new Operations: AddCustomer and

Page 5: Developing Web-Services With TIBCO ActiveMatrix BusinessWorks _ FishEyeView

9/13/2014 Developing Web-Services with TIBCO ActiveMatrix BusinessWorks | FishEyeView

http://fisheyefocus.com/fisheyeview/?p=146 5/15

RequestCustomer.

In the AddCustomer operation configuration, add an input message with the message schema set toCustomerInformation (we are now connecting the schema with the interface). We don’t need any outputmessage for this operation.

In the RequestCustomer operation configuration, add an input message with message schema set toCustomerInformationRequest and the output message with message schema set to CustomerInformation.

This can be seen in the screenshot below.

You will notice that till now we have been defining only the interface of the web-service (namely theoperations and messages). We have not spoken about things like which transport protocol to use or thestyle of the web-service (document vs. RPC).

The next step is to use the Service resource to configure the concrete endpoints using the interface wehave just defined. After that in the final step we will use the Service resource to join the abstract interfaceof the service with the actual implementation of the operations.

Step 2: Implementing the service endpoints using Service Resource

Add a Service resource from the Service menu.

The first thing we need to do is to give this service a ‘face’ (in other words define which interface it isgoing to ‘implement’).

Double-click it and within the Configuration tab click on the ‘+’ button in the ‘Implementation’ section.In the window that pops up locate the WSDL file (on the left side) with the abstract interface that youhave defined in Step 1. The PortType, Namespace and Operations will be loaded from the WSDL on theright hand side. This is shown in the screenshot below.

Page 6: Developing Web-Services With TIBCO ActiveMatrix BusinessWorks _ FishEyeView

9/13/2014 Developing Web-Services with TIBCO ActiveMatrix BusinessWorks | FishEyeView

http://fisheyefocus.com/fisheyeview/?p=146 6/15

Check the operations and the input and output for them. Click on ‘OK’.

The Service resource should contain a whole lot of new stuff now (see screenshot below). InConfiguration tab, the Implementation will have two tabs: Operations and Endpoint Bindings.

The next thing to do is to create the endpoint for the service. This involves defining style and encoding ofthe service and the operations and selecting the transport for the service.

Click the ‘Endpoint Bindings’ tab and then the ‘+’ to add a new endpoint. Change the Endpoint Type toSOAP and two more tabs will come up: Transport and SOAP Details.

Transport tab requires you to select a HTTP connection (as we are going for SOAP over HTTP in thisexample), which is required to host the service. Once the transport connection is set up you will see theEndpoint URI appear below it.

Next move to the SOAP Details tab. Define the default service style (document or RPC – in presentexample document) and the styles and encoding for the different operations within the service (in ourcase document – literal). You can set style to ‘Use Default Style’ to make your life easier in case ofmultiple operations.

The screenshot below shows this.

Page 7: Developing Web-Services With TIBCO ActiveMatrix BusinessWorks _ FishEyeView

9/13/2014 Developing Web-Services with TIBCO ActiveMatrix BusinessWorks | FishEyeView

http://fisheyefocus.com/fisheyeview/?p=146 7/15

The final step is to go ahead and implement the operations we have defined in interface.

Step 3: Implementing the service operations

Firstly we create the processes for adding customer information and requesting customer information.The only thing I will say about creating the processes is that the Start and End activities must have theiroutputs and inputs same as the WSDL messages setup for the corresponding web-service operation.

For example the process to handle request for customer information (i.e. RequestCustomerOperation)should have output for the Start activity a WSDL message: CustomerInformationRequest (that is theinput going in to the RequestCustomerOperation). Same goes for the input to the End activity whichshould be a WSDL message: CustomerInformation.

Go back up to the Operations tab and click on the ‘binocular’ button in the Operation Implementationcolumn next to the operation to be implemented. All processes which have input and output WSDLmessages matching the operation to be implemented will be shown in the window that pops up. Selectthe relevant processes. Do the same for all the operations defined in the interface.

The screenshot below shows the two operations for the example being implemented.

Test

Everything is now set for the web-service to be tested. But before we test the service it is worthwhile tosee the WSDL for the service that we have just created. Go to the WSDL Source tab in the Serviceresource. This is the WSDL for the service. You will need this file to create a test client.

Page 8: Developing Web-Services With TIBCO ActiveMatrix BusinessWorks _ FishEyeView

9/13/2014 Developing Web-Services with TIBCO ActiveMatrix BusinessWorks | FishEyeView

http://fisheyefocus.com/fisheyeview/?p=146 8/15

There are two ways to give a client access to the WSDL. First is to setup a WSDL retrieval process usingSOAP Retrieve Resources resource with a HTTP Receiver process starter. Then the client will be able todownload the WSDL as normal. The second option is to save the WSDL file (by clicking on Save WSDLin WSDL Source) and providing a local copy to the client.

We shall use SOAP UI (free edition) to test the TIBCO web-service. We setup a new SOAP UI projectwith a local copy of the WSDL file. SOAP UI creates test requests for the web-service as a part of theproject setup.

Make sure in the TIBCO Designer the Service resource and the processes implementing the operationshave been selected and run.

In SOAP-UI, go to the test request for the operation to be tested and double-click it. A blank request willopen up with ‘?’ where you need to fill in data to complete the request.

After filling in the data, execute the request by pressing the green ‘play’ button. On the right-hand sideyou will see the response of the request (if the operation has a response). In case of an error you will seean error response.

The screenshot below shows a test of the RequestCustomerOperation. The customer information requestsent is on the left-hand side and the response from the example web-service received on the right-handside.

Hope this limited example has explained how to setup a basic web-service in TIBCO AMBW using theService resource. There are several things that I have left out including using the SOAP Event Sourceprocess starter, using Contexts and retrieval of WSDL. All these topics deserve complete posts inthemselves that is why I aim to cover them as and when I get the time!

Note: If you are going to deploy to BW engine then you will need to create an archive file (.ear).Remember to include the Service Resource (if you are using it) in the Process Archive starter processesbefore building the archive.

Please leave comments and suggestions.

Update:

Have added a new post on WSDL retrieval for Service resource-based web-service.

Tags: TIBCO, Web Services

This entry was posted on Thursday, January 20th, 2011 at 11:22 pm and is filed under TIBCO, Web Services. You can followany responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Page 9: Developing Web-Services With TIBCO ActiveMatrix BusinessWorks _ FishEyeView

9/13/2014 Developing Web-Services with TIBCO ActiveMatrix BusinessWorks | FishEyeView

http://fisheyefocus.com/fisheyeview/?p=146 9/15

25 Responses to “Developing Web-Services with TIBCO ActiveMatrixBusinessWorks”

1. Peter Cole says:January 24, 2011 at 8:59 am

It’s great to see these how-tos on the web for new starters to TIBCO, shipped documentation oftenfalls short of telling you succinctly how to address your issue, so a big thanks.

A word of caution to anyone thinking of using SoapUI for testing though, it is extremely timeconsuming to set up any kind of automated testing. Green Hat’s GH Tester is a purpose builtapplication for test automation of TIBCO projects and offers incredible time-savings and fastreturn on investment, we have many converts from SoapUI.

2. sriram says:March 6, 2011 at 3:10 am

Hi,Its very useful

Thanks…

3. Treston says:April 4, 2011 at 5:53 am

Could you please give an alternate version of the above example with JMS. I tried it and didintwork. JMS worked with SOAPEventSource (means noting wrong with queue or messages inqueue) not with service Resource.What I found is that the Http Transport is working and JMS isnot working on the same SerivceResource.Please help.

Thanks,Treston

4. admin says:April 4, 2011 at 9:09 pm

Hi Treston,Could you please describe what error do you get/what happens when you try and run it? Is it aBinding error?

Regards,Azahar

5. Developing SOAP over JMS Web-Services using TIBCO BusinessWorks and Designer « TibcoBlog says:October 26, 2011 at 12:30 pm

Page 10: Developing Web-Services With TIBCO ActiveMatrix BusinessWorks _ FishEyeView

9/13/2014 Developing Web-Services with TIBCO ActiveMatrix BusinessWorks | FishEyeView

http://fisheyefocus.com/fisheyeview/?p=146 10/15

[...] <?xml version="1.0" encoding="UTF-8"?> <xs:schemaxmlns:xs="http://www.w3.org/2001/XMLSchema&quot;xmlns="http://www.tibco.com/schemas/WebServiceTest/Schema/Schema.xsd&quot;targetNamespace="http://www.tibco.com/schemas/WebServiceTest/Schema/Schema.xsd&quot;elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="add"><!– Request – two integers a and b to be added –> <xs:complexType> <xs:sequence> <xs:elementname="a" type="xs:int"/> <xs:element name="b" type="xs:int"/> </xs:sequence></xs:complexType> </xs:element> <xs:element name="result" type="xs:int"/> <!– Response – thesum of a and b –> </xs:schema> Now the next thing we need to do is to setup the ServiceResource. I won't go into the details of how it is done as I have already covered most of the steps ina different post. [...]

6. ganesh says:December 5, 2011 at 2:39 am

hi

i need to work on designing tibco webservice with two way SSL. wil you be be able to giuide methrough a example of creating bw webservice with two way SSL enabled i will pay as required

Thanks

ganesh

7. rainer says:January 17, 2012 at 11:44 am

Hi, I followed your steps in creating this CustomerInformation web-service. But sending testrequest from soapUI results in errors!For AddCustomer I receive a BindException in the process starter, and for RequestCustomer I getan Internal SOAP Error.Can you please provide your test-project as ZIP archive, so that I can see what I’m doing wrong?Thanks and regards, rainer

8. rainer says:January 17, 2012 at 1:25 pm

Hi, again I got the service running after starting from scratch! I also deployed it to my BW test engine andretrieving the WSDL works fine. But how can I test the operations from soapUI? The retrievedWSDL contains localhost in the soap:address? Should I change the hostname by hand in theWSDL file?Regards, rainer

9. admin says:January 24, 2012 at 8:56 pm

Hi Rainer,

Page 11: Developing Web-Services With TIBCO ActiveMatrix BusinessWorks _ FishEyeView

9/13/2014 Developing Web-Services with TIBCO ActiveMatrix BusinessWorks | FishEyeView

http://fisheyefocus.com/fisheyeview/?p=146 11/15

Never make changes to the WSDL file by hand. Use global variables wherever possible. To testfrom Soap UI you will need the WSDL file (generated by TIBCO) which you can use to create aSOAP UI project. Then you can invoke each of the operations through SOAP UI by providing testdata.

Hope this helps!Regards,Azahar

10. kiran badagala says:March 17, 2012 at 2:24 pm

Hi,this is very useful who are initiate with webservice thanq.thanqs,kiran.

11. sajjad says:June 11, 2012 at 9:44 pm

Very useful How-to guide for TIBCO web service. It would be great if you can enhanced this postby adding some material which shows the use of Contexts in web services.

Thanks,Sajjad

12. Venkat says:July 12, 2012 at 11:55 pm

Hi,Can you please advice how to write the Processes AddCustomer and GetCustomer and also how tosee them in Service – Operation Implementation. very very helpful to me if you can provide thesource.Thanks in advance.Venkat

13. amit kumar says:October 30, 2012 at 6:19 pm

awesome tutorial………….i cudn’t find nething better.this tutorial isprecise and clear.

please upload some more tutorial on web services.

thnx a lot !!

14. admin says:

Page 12: Developing Web-Services With TIBCO ActiveMatrix BusinessWorks _ FishEyeView

9/13/2014 Developing Web-Services with TIBCO ActiveMatrix BusinessWorks | FishEyeView

http://fisheyefocus.com/fisheyeview/?p=146 12/15

October 31, 2012 at 9:19 am

Will surely do… will try and post one on Contexts soon. Thank you for your comment!- Azahar

15. admin says:October 31, 2012 at 9:22 am

Hello Venkat,The addCustomer and getCustomer processes were blank implementations because I was exploringthe service creation side of things. The main thing to remember is – till you don’t define theprocess inputs and outputs as what is defined in your Operation, the process won’t be showing upin the Operation Implementation. The ‘signature’ of the process must match that of the operation.Let me know if you still need help.- Azahar

16. Sudha says:November 9, 2012 at 3:19 pm

Hello Azahar,Thanks a lot for this tutorial. I am very new to TIBCO and this was the best resource that helpedme. I am stuck with creating process definition part adn am not able to get that visible on Serviceresource like Venkat. This is what i did.1. I used basic celcius to fahrenheit conversion web service which takes one double paramter asinput and gives back one double parameter.2. I created process definition. The start activity has the output of WSDl message which issoapinput for the conversion process and the input for end activity is the soapoutput of the process.I followed what you mentioned on the blog, but a little blindly lol. May be I am missingsomething.

Can you please post on creating the process definition for this web service, please? It would reallybe helpful.

Thanks a lot

17. irfan ahmed shaikh says:February 28, 2013 at 8:27 am

Hello Azhar,

Thank you so much for such a detailed post.

RegardsIrfan

18. Siva says:March 9, 2013 at 6:08 am

Page 13: Developing Web-Services With TIBCO ActiveMatrix BusinessWorks _ FishEyeView

9/13/2014 Developing Web-Services with TIBCO ActiveMatrix BusinessWorks | FishEyeView

http://fisheyefocus.com/fisheyeview/?p=146 13/15

Hi Admin,

I tried with this example, it worked very well. But I stuck with one doubt. is it possible to get theoutputs from two operations at a time while running? Because it is giving output for the oneoperation which is selected in the concrete wsdl on soap request reply activity of client process.

19. Reddy says:August 7, 2013 at 8:20 am

Could you plz tell me that why we use soap action

20. admin says:August 9, 2013 at 10:31 am

@Reddy:We use the SOAP actions to implement web-services in TIBCO. When you use the SOAP processstarter it ties in the interface to the implementation.

To get around this we have the Service Resource method of creating web-services.

The method chosen is usually determined by practical reasons (e.g. is it just one process that has tobe exposed as a WS over a single protocol or are you looking to create a more complicated WSinterface which may be exposed over multiple protocols)

21. admin says:August 9, 2013 at 10:36 am

@Siva:

If you wanted you could call the two processes from within the one process defined in the WSDL.Then you would have to somehow combine the two results.

As I do not know the specifics of the problem – the only thing I can advise is examine if you needto break it into two separate operations even in the WS interface.

22. sushant says:September 6, 2013 at 9:50 am

can u plz share the project file….i m new to tibco…and i m stuck with addCustomer andgetCustomer processe definations…plz reply

23. midsouza says:October 1, 2013 at 3:29 pm

HiI am new to Tibco Designer – i tried this example however i am stuck at the service creation step…and see the following errors – in the WSDL Source tab of the Service ..

Page 14: Developing Web-Services With TIBCO ActiveMatrix BusinessWorks _ FishEyeView

9/13/2014 Developing Web-Services with TIBCO ActiveMatrix BusinessWorks | FishEyeView

http://fisheyefocus.com/fisheyeview/?p=146 14/15

[Service = CustomerInformationService; Implementation = CustomerInformation; Operation =RequestCustomer]: The input type of the process does not match the input of the operation[Service = CustomerInformationService; Implementation = CustomerInformation; Operation =RequestCustomer]: The output type of the process does not match the output of the operation[Service = CustomerInformationService; Implementation = CustomerInformation; Operation =AddCustomerOperation]: The input type of the process does not match the input of the operation[Service = CustomerInformationService; Implementation = CustomerInformation; Operation =AddCustomerOperation]: The output type of the process does not match the output of the operationThe Service has configuration errors. For more information, please validate the resource

Would it be possible for you to zip up your projects send it via email.. so that i can compare thesame with mine.

Thanks

24. admin says:February 19, 2014 at 4:57 pm

Hi midsouza,Please check the input types as defined in the process and the WS interface operation. There wouldbe a difference.

When you define and use a Service Resource – think of it like creating a mask. The back endimplementations should line up exactly with the mask.

25. Laura says:March 28, 2014 at 7:57 pm

Hi, this is a great article! now everything is working inside my tibco designer following your steps,but I am confused what is my next step in order to let me client to consume my web service. I wantto be able to give my client a link similar to this and then they can download the WSDL themself.http://66.45.53.162/JobDataHubSvc/JobDataHubSvc.svc?singleWsdl

I checked my developement machine, I don’t see the servcie hosted there, I was using “localhost”as my HTTP connection.

Do I need to deploy the service? and then?

Thanks a lot for your help!.

Leave a Reply

Name (required)

Mail (will not be published) (required)

Website

Page 15: Developing Web-Services With TIBCO ActiveMatrix BusinessWorks _ FishEyeView

9/13/2014 Developing Web-Services with TIBCO ActiveMatrix BusinessWorks | FishEyeView

http://fisheyefocus.com/fisheyeview/?p=146 15/15

Submit Comment

FishEyeView is proudly powered by WordPress Entries (RSS) and Comments (RSS).

Privacy & Terms

Type the text