Tuesday, June 29, 2010

OSB 11g leveraging Oracle DB Adapter

Continuing from the previous post...

Create a new file adapter (Read) in JDev







Create a new project in OSB Console and import the 2 new jca artifacts using -
Bulk --> Resources from URL

Create a Proxy based on the File (Read In) adapter
Create a Business Service based on the DB Adapter.

Edit the Proxy service message flow to route ...



Test the business service to generate test input -



use this as your test input file.

Monday, June 28, 2010

OSB 11g leveraging Oracle File Adapter

Simple scenario - read from one directory, write to another one.

Create a soa composite app in JDev and define the adapters, I also added a DB adapter which I'll leverage in a future post.



I'm using the following xsd for ReadIn and WriteOut.



Here are the JDev artifacts created -



Now I will import the .jca files into OSB11g using the Service Bus Console -

I create a new OSB project with the following structure -




IMPORTING THE FILE READ ADAPTER

I import the readIn.jca file as follows -







Click Import




Move the WSDL resource to the WSDL folder.



Navigate to the JCA artifact in the SB console and then click the action icon on the right.

1.gif

Click Generate



Proxy Service has been created.





If you look at the proxy service configuration you see it is leveraging
jca://eis/FileAdapter




This is configured on WLS so you can see this via the WebLogic console

Click on Deployments and navigate to FileAdapter




Click on Configuration and then
Outbound Connection Pools.





IMPORTING THE FILE WRITE ADAPTER

Do as above and then generate the business service by navigating to the JCA artifact in the SB console and then click the action icon on the right, targeting the Business Services folder.

Amend the proxy message flow to route to the business service.






Test by dropping a file into the input directory.




Thursday, June 24, 2010

OSB XQuery mapping array to flat structure

Scenario -

incoming xsd -
contains an "array" of hobbies.

outgoing xsd -
contains a flat structure containing -

hobby1
hobby2
hobby3

Input XSD as follows -






Target XSD -



I created a new project in OSB

I imported the 2 xsds.

I created the Xquery Transformation –
and map hobby to hobby1, hobby2 and hobby3.



Wednesday, June 16, 2010

OSB designtime missing from OEPE?

Maybe you forgot to check the appropriate box when installing OSB 11g.
You then start OEPE and find, quelle surprise, no OSB designtime.

You will see that your platform.xml file
(located at YourOSBInstallDir\oepe_11gR1PS2\configuration\org.eclipse.update)
doesn't include the following OSB designtime entries -



Workaround -

Essentially the Oracle OSB plugins are on the disk but not taken into account by eclipse, so you must :
- modify file (with the sample file available at
http://docs.google.com/leaf?id=0B7YrnfO7h717ZjRmYjEyNzEtM2JlNy00YjIzLWIzN2EtNGU4ZDg0ZTg0MzBk&hl=en

- modify the "config.ini" file with "org.eclipse.update.reconcile" to "true" just for one restart of Eclipse (to take into account plugins update)

Merci beaucoup to Julien at Cap Gemini for the workaround.

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