Upload
soa-training
View
222
Download
0
Embed Size (px)
Citation preview
8/3/2019 OSB_Cobol on the Bus
1/30
Cobol on the Bus - Cobol Copybooks & Oracle Service Bus
11g Part 1
This article is from the excellent Blog by Niall Commiskey.
See complete article here - http://niallcblogs.blogspot.com/2010/06/cobol-on-bus-
cobol-copybooks-oracle.html
I'm back doing some work on Oracle OSB11g - preparing a POC showing integration with CobolCopybooks.I actually began my IT life programming Cobol on Honeywell DPS8 for the IrishRevenue Commissioners so it was a bit deja vu for me. For those post-Cobol baby boomershere's an example of such a cobol copybook -
000100 01 PERSON.
000200 05 PERSON-FIRST-NAME PIC X(10).
000300 05 PERSON-LAST-NAME PIC X(10).
000400 05 PERSON-COUNTRY PIC X(02).
000500 05 REQUEST-TYPE PIC X(01).
save the above to a file with the extension .cpy e.g. person.cpy
This is a very simple person definition - X --> alpha.
In this scenario we receive a message that adheres to the definition in the Cobol Copybook.If it isof request type "C" (Create) we will route to the create operation of the Person businessservice.If it is of request type "U" (Update) we will route to the update operation of the Personbusiness service.If it is of request type "D" (Delete) we will route to the delete operation of thePerson business service. We will now implement what will be our OSB Business Service.
Create Person Web Service
In JDev simply create a Java class that implements 3 methods -
createPerson(String name)updatePerson(String name)deletePerson(String name)
8/3/2019 OSB_Cobol on the Bus
2/30
Create a new App server connection
http://1.bp.blogspot.com/_gWwhpxFZjGs/TBd17PgnI7I/AAAAAAAABA0/EJwqqCHroEQ/s1600/2.GIFhttp://4.bp.blogspot.com/_gWwhpxFZjGs/TBd1x1evDiI/AAAAAAAABAs/YV2xIIFU7qI/s1600/1,gif.gif8/3/2019 OSB_Cobol on the Bus
3/30
Expose as a web service and deploy to the WLS instance running OSB.
http://2.bp.blogspot.com/_gWwhpxFZjGs/TBd17QBDBII/AAAAAAAABBE/S8qBY3B3UXI/s1600/4.GIFhttp://3.bp.blogspot.com/_gWwhpxFZjGs/TBd17frM1eI/AAAAAAAABA8/VfruicCIKZc/s1600/3.GIF8/3/2019 OSB_Cobol on the Bus
4/30
Test the web service via the WLS console e.g. localhost:7021/console --> deployments --> testetc.
http://4.bp.blogspot.com/_gWwhpxFZjGs/TBd2QJpWZ-I/AAAAAAAABBU/NsZ9cpR-81o/s1600/6.GIFhttp://4.bp.blogspot.com/_gWwhpxFZjGs/TBd2P59r0KI/AAAAAAAABBM/0TUGNAPxWA8/s1600/5.GIF8/3/2019 OSB_Cobol on the Bus
5/30
Create an OSB project with the following folder structure -
Create a new MFL in the MFL folder -
http://4.bp.blogspot.com/_gWwhpxFZjGs/TBdTsjVY2bI/AAAAAAAAA_M/NZy7iXN18eI/s1600/1.GIFhttp://1.bp.blogspot.com/_gWwhpxFZjGs/TBd2QTvu0_I/AAAAAAAABBc/EgTJgWKrnJI/s1600/7.GIF8/3/2019 OSB_Cobol on the Bus
6/30
Double click on the newly created file to start Format Builder.Import Cobol Copybook...
http://1.bp.blogspot.com/_gWwhpxFZjGs/TBdSh0msdBI/AAAAAAAAA-k/dl91ttsSYB4/s1600/3.GIFhttp://3.bp.blogspot.com/_gWwhpxFZjGs/TBdTsswXDiI/AAAAAAAAA_U/rNj5sdUacC8/s1600/2.GIF8/3/2019 OSB_Cobol on the Bus
7/30
Specify your person.cpy file
http://4.bp.blogspot.com/_gWwhpxFZjGs/TBdSjOo2OBI/AAAAAAAAA-0/Oh1D4YxOvMY/s1600/5.GIFhttp://1.bp.blogspot.com/_gWwhpxFZjGs/TBdSigmpiOI/AAAAAAAAA-s/FYV2ro_AJoM/s1600/4.GIF8/3/2019 OSB_Cobol on the Bus
8/30
Specify delimiter we will use carraige return \n
Test the MFL
http://1.bp.blogspot.com/_gWwhpxFZjGs/TBdSj8HsMdI/AAAAAAAAA_E/U3DocCJvX6I/s1600/7.GIFhttp://3.bp.blogspot.com/_gWwhpxFZjGs/TBdSjT7cJpI/AAAAAAAAA-8/OlkINpCqhd0/s1600/6.GIF8/3/2019 OSB_Cobol on the Bus
9/30
Note the HEX 0a has been added for carriage return
http://4.bp.blogspot.com/_gWwhpxFZjGs/TBd8piOETVI/AAAAAAAABCE/QAKyzvBtd48/s1600/3.GIFhttp://1.bp.blogspot.com/_gWwhpxFZjGs/TBd9DC_vWeI/AAAAAAAABCc/d6Xn962FzGw/s1600/2.GIFhttp://2.bp.blogspot.com/_gWwhpxFZjGs/TBd9DJMk44I/AAAAAAAABCk/a5q5e3ElchI/s1600/1.GIF8/3/2019 OSB_Cobol on the Bus
10/30
Save this input file for use in later testing.
http://1.bp.blogspot.com/_gWwhpxFZjGs/TBd8os01IVI/AAAAAAAABBs/1_w4765FqD4/s1600/6.GIFhttp://3.bp.blogspot.com/_gWwhpxFZjGs/TBd8pBT5wYI/AAAAAAAABB0/8FTtWKYlwbU/s1600/5.GIFhttp://2.bp.blogspot.com/_gWwhpxFZjGs/TBd8pRy7qGI/AAAAAAAABB8/hZXX6pNO-oE/s1600/4.GIF8/3/2019 OSB_Cobol on the Bus
11/30
Now we will create the business service based on the Person web service we
deployed earlier.
Create the Business Service
All we need is the wsdl from the service we created earlier -
http://1.bp.blogspot.com/_gWwhpxFZjGs/TBeR9t2h2RI/AAAAAAAABDc/3uZPzlS9X-A/s1600/1.GIFhttp://2.bp.blogspot.com/_gWwhpxFZjGs/TBd8oU6vrMI/AAAAAAAABBk/jff5BnQuR3U/s1600/7.GIF8/3/2019 OSB_Cobol on the Bus
12/30
e.g.http://localhost:7021/PersonProcessorWS-PersonProcessorWS-context-root/PersonProcessorImplPort?WSDL
Consume the existing web service
http://localhost:7021/PersonProcessorWS-PersonProcessorWS-context-root/PersonProcessorImplPort?WSDLhttp://localhost:7021/PersonProcessorWS-PersonProcessorWS-context-root/PersonProcessorImplPort?WSDLhttp://localhost:7021/PersonProcessorWS-PersonProcessorWS-context-root/PersonProcessorImplPort?WSDLhttp://4.bp.blogspot.com/_gWwhpxFZjGs/TBeR9Wc9u5I/AAAAAAAABDU/NynHtJrisR4/s1600/2.GIFhttp://localhost:7021/PersonProcessorWS-PersonProcessorWS-context-root/PersonProcessorImplPort?WSDLhttp://localhost:7021/PersonProcessorWS-PersonProcessorWS-context-root/PersonProcessorImplPort?WSDL8/3/2019 OSB_Cobol on the Bus
13/30
Click "OK"
http://3.bp.blogspot.com/_gWwhpxFZjGs/TBeP6U4Y5vI/AAAAAAAABDE/qCdymNnAFqw/s1600/4.GIFhttp://2.bp.blogspot.com/_gWwhpxFZjGs/TBeP6nSWdoI/AAAAAAAABDM/tNiR22R10eo/s1600/3.GIF8/3/2019 OSB_Cobol on the Bus
14/30
Set Load Balancing Algorithm to none
We now have the following artifacts in our OSB project
http://1.bp.blogspot.com/_gWwhpxFZjGs/TBeP51js1tI/AAAAAAAABC0/qYZzGO5_47g/s1600/6.GIFhttp://2.bp.blogspot.com/_gWwhpxFZjGs/TBeP6IFsjRI/AAAAAAAABC8/IKBjYf6gl68/s1600/5.GIF8/3/2019 OSB_Cobol on the Bus
15/30
Create the Proxy Service
In this scenario, our proxy service will read in the Cobol data from a directorye.g. D:\WorkshopEnvs\OSB11g\demos\Cobol-In-Dir
create this input directory along with ones for stage, error, archive.
So now you should have 4 directories -D:\WorkshopEnvs\OSB11g\demos\Cobol-In-DirD:\WorkshopEnvs\OSB11g\demos\Cobol-Error-DirD:\WorkshopEnvs\OSB11g\demos\Cobol-Stage-DirD:\WorkshopEnvs\OSB11g\demos\Cobol-Archive-Dir
http://2.bp.blogspot.com/_gWwhpxFZjGs/TBeUDftDgxI/AAAAAAAABEE/JVTHAJyIf1Y/s1600/1.GIFhttp://4.bp.blogspot.com/_gWwhpxFZjGs/TBeP5o145oI/AAAAAAAABCs/XHHsOMFx9mI/s1600/7.GIF8/3/2019 OSB_Cobol on the Bus
16/30
On the General Tab --> Messaging Service
On the Messaging Tab -->
Transport Config --> File, specify input directory
http://1.bp.blogspot.com/_gWwhpxFZjGs/TBeUC7PMTjI/AAAAAAAABD0/WryxKoVDo10/s1600/3.GIFhttp://1.bp.blogspot.com/_gWwhpxFZjGs/TBeUDI6PEvI/AAAAAAAABD8/J3KtCAiLBG0/s1600/2.GIF8/3/2019 OSB_Cobol on the Bus
17/30
File Transport -->
Implementing the Message processing logicEssentially our business processing will involve checkimg what action is specified in the datacoming from the Cobol based system.
Remember - PERSON-REQUEST-TYPE = "C" - Create etc.
If create then we call the "createPerson" operation of the Person Business Service.
http://1.bp.blogspot.com/_gWwhpxFZjGs/TBeUCSm6kBI/AAAAAAAABDk/KjqBeBrCeZw/s1600/5.GIFhttp://3.bp.blogspot.com/_gWwhpxFZjGs/TBeUCtDXiPI/AAAAAAAABDs/HmSTa_7XzzM/s1600/4.GIF8/3/2019 OSB_Cobol on the Bus
18/30
But we need to amend the payload -
remember OSB is getting the full Cobol payload, all the business service requires is the lastname.
So here are the steps we have to go thru -
1. check what action is required e.g. "C"2. create a variable reflecting the parameter the action requires. e.g. create a variable based on thecreatePerson operation input data type.3. Assign the last name from the payload to this variable4. copy the variable to the OSB message body ($body is what will be passed to the businessswervice).5. call the relevant business service.
StepsCreate a Pipeline pair
Insert a log activity to output the incoming message
http://2.bp.blogspot.com/_gWwhpxFZjGs/TBfWKSYfb5I/AAAAAAAABEs/aNFc33ndlp8/s1600/1.GIF8/3/2019 OSB_Cobol on the Bus
19/30
I set the level to ERROR so that I can see the message in the WLS console.
Add a Route Node
http://3.bp.blogspot.com/_gWwhpxFZjGs/TBfWJbdYhaI/AAAAAAAABEc/-iX9w9zPBqI/s1600/3.GIFhttp://2.bp.blogspot.com/_gWwhpxFZjGs/TBfWJ6ZNkiI/AAAAAAAABEk/dIEAjKH2p8o/s1600/2.GIF8/3/2019 OSB_Cobol on the Bus
20/30
Add a Routing Table
Add case --> route based on request type
http://4.bp.blogspot.com/_gWwhpxFZjGs/TBfWIqEIJnI/AAAAAAAABEM/AeKZrBkBgVk/s1600/5.GIFhttp://2.bp.blogspot.com/_gWwhpxFZjGs/TBfWJEeQq_I/AAAAAAAABEU/LFtR7wtfgTQ/s1600/4.GIF8/3/2019 OSB_Cobol on the Bus
21/30
Specify target service
http://1.bp.blogspot.com/_gWwhpxFZjGs/TBfXEkAdhWI/AAAAAAAABFM/7CEefA_jwRA/s1600/7.GIFhttp://3.bp.blogspot.com/_gWwhpxFZjGs/TBfXE4kOV9I/AAAAAAAABFU/6getVKYnuIY/s1600/6.GIF8/3/2019 OSB_Cobol on the Bus
22/30
Specify "update" as the default operation for the Default route.
http://1.bp.blogspot.com/_gWwhpxFZjGs/TBfXELUTi7I/AAAAAAAABFE/5fXiFscqFQA/s1600/8.GIF8/3/2019 OSB_Cobol on the Bus
23/30
Now we can do the specific processing for the "create" route.
Create an XQuery mapping for OSB-input to create-person service input
http://3.bp.blogspot.com/_gWwhpxFZjGs/TBfXDY30ZxI/AAAAAAAABE0/pu8wzDmJx7E/s1600/10.GIFhttp://1.bp.blogspot.com/_gWwhpxFZjGs/TBfXD5MIZKI/AAAAAAAABE8/ZmQgM3JasqI/s1600/9.GIF8/3/2019 OSB_Cobol on the Bus
24/30
Add an Assign Activity
http://3.bp.blogspot.com/_gWwhpxFZjGs/TBfXwaME21I/AAAAAAAABFs/dlCa72X1y6Y/s1600/13.GIFhttp://3.bp.blogspot.com/_gWwhpxFZjGs/TBfXwv-fm-I/AAAAAAAABF0/TbM1KvRJGNU/s1600/12.GIFhttp://2.bp.blogspot.com/_gWwhpxFZjGs/TBfXw1ShtgI/AAAAAAAABF8/0Z5_SDa_Iyo/s1600/11.GIF8/3/2019 OSB_Cobol on the Bus
25/30
Add a variable of type createPerson
http://1.bp.blogspot.com/_gWwhpxFZjGs/TBfXvlNZ65I/AAAAAAAABFc/geOmSPD5eho/s1600/15.GIFhttp://3.bp.blogspot.com/_gWwhpxFZjGs/TBfXwAOBClI/AAAAAAAABFk/7rwbFuniqkc/s1600/14.GIF8/3/2019 OSB_Cobol on the Bus
26/30
http://1.bp.blogspot.com/_gWwhpxFZjGs/TBfYofkq12I/AAAAAAAABG8/pmSzLssBNBQ/s1600/17.GIFhttp://1.bp.blogspot.com/_gWwhpxFZjGs/TBfYorRp-pI/AAAAAAAABHE/l6D0bbubYcY/s1600/16.GIF8/3/2019 OSB_Cobol on the Bus
27/30
Add a Log activity to output the newly created variable
http://4.bp.blogspot.com/_gWwhpxFZjGs/TBfbFNBCevI/AAAAAAAABH0/HW6fWvqGNFI/s1600/1.GIFhttp://2.bp.blogspot.com/_gWwhpxFZjGs/TBfZDBYAdII/AAAAAAAABHs/Mseo13vrcdg/s1600/21.GIFhttp://1.bp.blogspot.com/_gWwhpxFZjGs/TBfYPzlQ0HI/AAAAAAAABGE/k2rV4PXeOxs/s1600/20.GIF8/3/2019 OSB_Cobol on the Bus
28/30
After the Log add a Replace activity to replace the $body value with that of $createPerson
Add a Log activity to output the new value of $body
In the Response Pipeline -->result from the business service
http://1.bp.blogspot.com/_gWwhpxFZjGs/TBfZCXeajcI/AAAAAAAABHc/lMO2AxcCjIs/s1600/23.GIFhttp://2.bp.blogspot.com/_gWwhpxFZjGs/TBfZCvH2SSI/AAAAAAAABHk/zIfksdsBVUE/s1600/22.GIF8/3/2019 OSB_Cobol on the Bus
29/30
Test
1 comments:
Raju said...
Thanks for the information shared here. that was an interesting and informative. I had agood experience by participating in the Cloud Computing and SOA Conference in 2009which is most influential Business Technology Conference covering latest innovationsand trends of Cloud Computing, SOA and its technologies. I learnt lot of newtechnologies in Cloud Computing. And I am planning to attend 2010 edition as well. Ifound the information about the conference from http://www.btsummit.com
http://www.blogger.com/profile/11405901077609772826http://www.blogger.com/profile/11405901077609772826http://3.bp.blogspot.com/_gWwhpxFZjGs/TBfZBrTPYJI/AAAAAAAABHM/xIoktPDF278/s1600/25.GIFhttp://4.bp.blogspot.com/_gWwhpxFZjGs/TBfZCEqKrcI/AAAAAAAABHU/LJK0pVNU6nk/s1600/24.GIFhttp://www.blogger.com/profile/114059010776097728268/3/2019 OSB_Cobol on the Bus
30/30