Jul 10, 2008

The lost (collaxa) BPEL-tutorials: 104.SyncQuoteConsumer

The SyncQuoteConsumer tutorial shows how to call another BPEL workflow. As the title indicates, this is done in a synchronous way. (If you want to know how to call a BPEL workflow in an asynchronous way, wait for 105...)

To get the tutorial running you have to change in samples/utils/StockQuoteService in the StockQuoteService.bpel in bpelx:exec name="validate" the Element to oracle.xml.parser.v2.XMLElement:

String symbol = ((oracle.xml.parser.v2.XMLElement)
getVariableData("input", "symbol","/symbol"))

Here a screenshot of the original code and the changes made visible with the history feature of Jdeveloper:
(With the third tab on the bottom of the window, you can see, what changes you have done to your sources.)

In the StockQuoteService you have to change the build.properties to your port and password:
#admin.user = oc4jadmin
admin.password = mysecret
# http.hostname and http.port should point to BPEL Server's host and http port
#http.hostname = localhost
http.port = 7777
To deploy the StockQuoteService and the SyncQuoteConsumer you only have to run ant on the SyncQuoteConsumer build.xml because in this file the following is defined:

<target name="deploy" depends="pre-build, process-deploy, post-build" />
and the pre-build.xml just says:
<?xml version="1.0"?/>
<project name="bpel.pre-build" default="pre-build" basedir="."/>
<target name="StockQuoteService"/>
<ant dir="../../utils/StockQuoteService"//>
<target name="pre-build" depends="StockQuoteService"//>
and so both BPEL projects are deployed with one ant run.

To add a PartnerLink to a BPEL project follow this documentation.
The service explorer window should show the following (this works only after the deployment of the StockQuoteService!):
For more information about PartnerLinks look at this link.
Your PartnerLink has to look like:
If you want to change the PartnerLink to another BPEL click on the torch (red square) and you will get back to the service explorer.

To see that everything was done right, you can run the SyncQuoteConsumer with this message:

<symbol xmlns="http://samples.otn.com">ORCL</symbol>
and you will get the stock quote for Oracle....

One good thing of synchronous invocations: You need no correlation sets and it is very easy, but if the called instance needs more than 45s, you will get an ORABPEL-05002 error. You can learn avoiding it on my posting two months ago.

No comments:

Post a Comment