Tuesday, August 18, 2015

Creating a Service, WSDL, Schema for WSDL and operations with TIBCO BW 6.0

Hi,

Recently our BizTalk team started to work on a huge mission - migration from BizTalk Server to TIBCO ActiveMatrix BusinessWorks 6.
TIBCO ActiveMatrix BusinessWorks 6 is one of the most powerful enterprise integration platforms on the market.

As the project leader, one of our goals is to write clear documents which match the development strategy.
So here is the first piece. 
In this document, we would create a "Human" service with two operations: Walk & Sleep.

TibSrv_Human

Create Process

1. Choose Processes --> New --> BusinessWorks Process





2. Set "Package" to "Starters"
Set "Process Name" to "TibSrv_Human"





Press Finish.

Create Service & Operation

3. Now we would create the service inside the process.
Navigate to the green arrow on the right and click it.



4. In the "New Service" pop-up, choose "Create a new WSDL".
Set "File Name" to "TibSrv_Human.wsdl"
Set "Target Namespace" to "http://thisismytest.com/WSDL/TibSrv_Human/TibSrv_Human.wsdl"
Set "Interface Name" to "TibSrv_Human"
Set "Operation Name" to "operation_Walk"
Mark "Output" and "Throw a Fault" with V sign.


Press Next.

5. In the next screen you need to assign a schema to the new wsdl.
Set "File Name" to "TibSrv_Human.xsd"
Set "Target Namespace" to "http://thisismytest.com/Schemas/TibSrv_Human/TibSrv_Human.xsd"


       Press Finish.

After pressing Finish, your workspace should look like this:



6. Press right click on "operation_Walk" --> Operation --> Implement Constructor Operation




After clicking, you should get the following screen:



7. Choose from Project Explorer -->  Module Descriptors --> Components
Under "ComponentTibSrv_Human", choose "TibSrv_Human" and press Properties view.



8. Choose "Bindings" tab, and press "Add Binding" button on the right:



9. Choose "SOAP Binding"



    Press Finish.

10. Set "Name"
a. For HTTP binding - to "TibSrv_Human_HTTP" 
b. For JMS binding - to "TibSrv_Human_JMS" 
Also choose the relevant "Transport Type", "HTTP Connector Name" and "Endpoint URI"



Create Schemas

11. Now we will create Request\Response schemas.
From project explorer choose Schemas --> New --> XML Schema File



12. Set "Name" to "Walk_Request.xsd".




Press Finish.

By pressing double-click on "Walk_Request.xsd" schema, you should see the schema GUI:



13. Set "Target namespace" to "http://thisismytest.com/Schemas/TibSrv_Human/Walk_Request.xsd".

14. Press right click on "Elements", and then choose "Add Element".




15. Set "Name" to "Walk_Request", and from "Type" drop-down-list choose "New"





16. You should see the "NewType" pop-up.
Set to "Complex Type", and mark "Create as local anonymous type" option.



Press OK.


17. Now that you have a new root element, please press double click on it.





You should be moved to this screen:




18. Right click on "(Walk_RequestType)" and click on "Add Element".




19. Set "Name" to "Kilometers".



20. For the response schema (Walk_Response.xsd) repeat 11-19 steps.


Configuring the schemas inside the abstract WSDL

21. On project explorer, open "Service Descriptors" and choose "TibSrv_Human.wsdl".




22. Press the arrow near "operation_WalkRequest".




23. Right click on "in" parameter from "(operation_WalkRequestType)".
Press Delete.



24. Right click on "(operation_WalkRequestType)".
Choose "Add Element Ref".




25. From the "Reference" drop-down list, choose "Browse…"



26. From the "Set element reference" pop-up, Set "Search scope" to "Workspace", and then choose "Walk_Request".



Press OK.

27. Repeat 22-26 steps in order to configure the response schema.

Create another operation

28.       Right Click on the service name à Refactor à Create Operation



29.       From the "Create Operation" pop-up:
Set "Operation Name" to "operation_Sleep"
Choose "Request-Response".
Tick "Throw a Fault" option.

Press OK.
30.       From "Basic Activities", choose "Constructor" shape, and drag it to the process GUI.



31.       Choose the green starter (Marked with "1" in the following image).
Click "Select a Partner Link" arrow (Marked with "2" in the following image), choose "TibSrv_Human".
Click "Select an operation" arrow (Marked with "3" in the following image), choose "operation_Sleep".



32.       From "Basic Activities", choose "Reply" shape, and drag it to the "operation_Sleep" GUI.



33.  Click the "Reply" shape, and Set "Name" to "operation_SleepOut".
Click "Select a Partner Link" arrow and choose "TibSrv_Human".
Click "Select an operation" arrow and choose "operation_Sleep".



34.       Repeat steps 11-26, in order to create the operation schemas and relate them to the service wsdl.

Creating a Sub-Process with TIBCO BW 6.0

A sub-process is actually a process without a component which exposes it. A sub-process will not have a SOAP binding (JMS/HTTP), but would have a wsdl.

1.       On project explorer, choose "Processes" à "New" à BusinessWorks Process

2.   Set "Package" to "Walk"
Set "Process Name" to "WalkDispatcher"


Press Finish.

3.       Now we would create the service inside the process.
Navigate to the green arrow on the right and click it.



4.   In the "New Service" pop-up, choose "Create a new WSDL".
                        Set "File Name" to "WalkDispatcher.wsdl"
Set "Target Namespace" to "http://thisismytest.com/WSDL/TibSrv_Human/WalkDispatcher.wsdl"
Set "Interface Name" to " WalkDispatcher"
Set "Operation Name" to "operation_Walk"
Mark "Output" and "Throw a Fault" with V sign.





Press Next.

5.       We would use WSDL inline schema in order to represent the service.
Choose "Create WSDL inline schema".


Press Finish.

6.       In Project explorer, choose Components.
Delete "ComponentWalkDispatcher".



7.       Now you can go to "WalkDispatcher.wsdl", and define appropriate Request & Response schemas (In each operation defined in the inline wsdl schema. See also 21-26 steps).

Summary

That's it! 
Now you have a Process which contains a Service (with Service WSDL named "TibSrv_Human.wsdl" and "TibSrv_Human.xsd" attached to it). 
"TibSrv_Human.xsd" contains the service operations elements, and inside them you can configure elements or a reference to other schema.

You can now add sub-process invokation to the main process, which is the entry point of all operations: 
On "TibSrv_Human" process, add an invoke shape which calls "WalkDispatcher" sub-process from "operation_Walk".

See you next time with some more interesting stuff!

4 comments:

Thank you Blogger, hello Medium

Hey guys, I've been writing in Blogger for almost 10 years this is a time to move on. I'm happy to announce my new blog at Med...