Tuesday, June 15, 2010

Cobol on the Bus - Cobol Copybooks & Oracle Service Bus 11g Part 2

Continuing on...

We have already created our OSB process and included the MFL.

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 -

e.g. http://localhost:7021/PersonProcessorWS-PersonProcessorWS-context-root/PersonProcessorImplPort?WSDL

Consume the existing web service

Click "OK"

Set Load Balancing Algorithm to none

We now have the following artifacts in our OSB project

Create the Proxy Service

In this scenario, our proxy service will read in the Cobol data from a directory
e.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 -

On the General Tab --> Messaging Service

On the Messaging Tab -->

Transport Config --> File, specify input directory

File Transport -->

Implementing the Message processing logic
Essentially our business processing will involve checkimg what action is specified in the data coming 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.

But we need to amend the payload -

remember OSB is getting the full Cobol payload, all the business service requires is the last name.

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 the createPerson operation input data type.
3. Assign the last name from the payload to this variable
4. copy the variable to the OSB message body ($body is what will be passed to the business swervice).
5. call the relevant business service.

Create a Pipeline pair

Insert a log activity to output the incoming message

I set the level to ERROR so that I can see the message in the WLS console.

Add a Route Node

Add a Routing Table

Add case --> route based on request type

Specify target service

Specify "update" as the default operation for the Default route.

Now we can do the specific processing for the "create" route.

Create an XQuery mapping for OSB-input to create-person service input

Add an Assign Activity

Add a variable of type createPerson

Add a Log activity to output the newly created variable

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



Raju said...

Thanks for the information shared here. that was an interesting and informative. I had a good experience by participating in the Cloud Computing and SOA Conference in 2009 which is most influential Business Technology Conference covering latest innovations and trends of Cloud Computing, SOA and its technologies. I learnt lot of new technologies in Cloud Computing. And I am planning to attend 2010 edition as well. I found the information about the conference from http://www.btsummit.com

M A.zaib Mughal said...

will you please explain how to test this example acually i am a fresh candidate..

M A.zaib Mughal said...

will you please explain how to test this example acually i am a fresh candidate..

Niall Commiskey said...

I hope my offline support sufficed.

niall C.

Anonymous said...

Niall, Could you please help what dataype to use in MFL for PIC 9(10) and PIC 9(08)V9(06). Also what should be the equivalent datatype in java

Niall Commiskey said...

Just click on the menu "Options" when you are in the format builder, then activate XSD generation. You will see the generated XSD when you return to your OSB project and do a refresh.

I assume the xml datatype will be decimal. I would then tend towards using the Java BigDecimal datatype.

Please let me know if this works for your use case.

Niall C.