Tuesday, June 2, 2009

Webmethods Basic Flow Service Structure

This Blog will explain the basic structure of a webmethods flow service. It has initialise sequence followed by a try/Catch and finally block.Lets have a look at the properties at each stages of the sequence.


Open Webmethods Developer and create a flow service called personService as shown in the following diagram. Please make sure that the document types are already created for your input and output docs.



If you want to try out some more features like branches,loops etc, you can design your flow service like the following diagram.



Set the ExitOn property for Try/Catch Sequence based on the following diagram.



Similarly set the Exit on prperty for Catch sequence to DONE and default(Failure) for Finally sequence. Run/Step through the Service with appropirate input Payload and check the results


Hope you find this article useful



Regards,

Amol

Wednesday, January 21, 2009

Execute and Receive Response from PERL Script using Java Embedding (BPEL)

Sometimes it is easier and faster to carry out complex jobs using external scripts(e.g PERL)such a breaking a file into multiple files, record level validation of flat records etc. This blog details the technical information regarding how to execute PERL script in Java Embedding node under BPEL flow. It also receives response from PERL script for further validation. Please make sure that Perl is already installed on the server.


Let’s create a small Synchronous BPEL process called PERLExample.bpel which looks like following figure.



Declare a global simple string type variable as given below to capture the response from perl script.

<variable name="Variable_PerlResponse" type="xsd:string"/>

The Case condition for checking the response is

bpws:getVariableData('Variable_PerlResponse')='Success'

We will set the value of Varibale_PerlResponse in Java Embedding depending on the response received from Perl script execution.


Now let’s concentrate on Java Embedding (Java_Call_PerlScript) node which actually calls the Perl script. The Perl script takes a parameter(String called “Param1”) and returns a string response. Following screen shot gives you understanding of the java code written in Java embedding node. Make sure to include following java classes before the java embedding node in bpel flow source.


<bpelx:exec import="java.io.*"/>
<bpelx:exec import=" java.io.BufferedReader"/>


String cmdString has the location of Perl install, Perl script file with the location ( sample.pl in this instance )and paramONE as a parameter.
Create a file called sample.pl in data/int folder. Add the following perl code inside the file.



The Perl script will be executed at run time and based on the parameter value, it will return the appropriate string response back to the caller.
Deploy the BPEL process on any of the domain and test it using SOAP UI or BPEL Console.

Thursday, January 1, 2009

orcl:lookup-dvm() in BPEL


Though we set up the dvm in esb console,orcl:lookup-dvm() can be used in BPEL for hot configuring your mappings. One of the main advantages of dvm configurations is independence from deployment i.e for changing the mappings, there is no re-deployment needed.


There are two ways you can use orcl:lookup-dvm() in BPEL.

1) In Assign node and 2) In Transformation xsl.

Lets say the DVM is configured like Fig-1 in your ESB dvm tab under your esb console.Now in assign node, the code to assign appropriate age to name would be


<assign name="Assign_DVM>
<copy>
<from expression='orcl:lookup-dvm("SampleDVM","Name",rbi:Details/vhr:name,"Age","")'/>
<to variable="OutputVariable" part="payload" query="/ns1:Details/ns2:Employee/ns21:Age"/>
</copy>
</assign name="Assign_DVM>

In the above code, the age will be dynamically assigned for variable rbi:Details/vhr:name by using orcl:lookup-dvm() advance funtion.


In any Transformation xsl, the same logic can be used under BPEL project for dynamically mapping the Age value based on the dvm configuration.


<tns:Age>
<xsl:value-of select='orcl:lookup-dvm("SampleDVM","Name",rbi:Details/vhr:name,"Age","")'>
</tns:Age>

I hope you find this article useful.

Regards,

Amol