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 -
D:\WorkshopEnvs\OSB11g\demos\Cobol-In-Dir
D:\WorkshopEnvs\OSB11g\demos\Cobol-Error-Dir
D:\WorkshopEnvs\OSB11g\demos\Cobol-Stage-Dir
D:\WorkshopEnvs\OSB11g\demos\Cobol-Archive-Dir





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.

Steps
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



Test



5 comments:

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

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

    ReplyDelete
  3. I hope my offline support sufficed.

    thanks
    niall C.

    ReplyDelete
  4. 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

    ReplyDelete
  5. 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.

    Thanks
    Niall C.

    ReplyDelete