« Using BPEL with a VCS | Main | Invoking an EJB from BPEL using WSIF »

Invoking BPEL from C#

Calling BPEL from C#


Thought I'd have a go at calling a BPEL process from C#.  So I downloaded Microsoft Visual C# 2005 Express Edition this afternoon and got ready to fight the monster.


Well it turns out that the monster is a pussycat, it worked first time.


I took a simple BPEL process that takes two strings as input and returns a string and a boolean that indicate if they are the same or not.  The appropriate input and output elements are:


        <element name="EqualsProcessRequest">
<complexType>
<sequence>
<element name="delay" type="long"/>
<element name="input1" type="string"/>
<element name="input2" type="string"/>
</sequence>
</complexType>
</element>
<element name="EqualsProcessResponse">
<complexType>
<sequence>
<element name="equal" type="boolean"/>
<element name="same" type="string"/>
</sequence>
</complexType>
</element>

I fired up Visual C#, created a "Web Reference" to the BPEL process WSDL file.  This created wrapper objects for the process and its variables.  The default generation worked perfectly and the following C# code invoked the BPEL process.


      String str1 = "String1";
String str2 = "String2";
EqualsBpelProcess.Equals bpel = new SimpleWebClient.EqualsBpelProcess.Equals();
EqualsBpelProcess.EqualsProcessRequest req = new SimpleWebClient.EqualsBpelProcess.EqualsProcessRequest();
req.input1 = str1;
req.input2 = str1;
EqualsBpelProcess.EqualsProcessResponse resp = bpel.process(req);
Console.WriteLine(str1+" = "+str2+" is "+resp.same+"("+resp.equal+")");

The above C# could probably be cleaner - this was my first C# application after all. Calling BPEL from C# is really that easy! The wonderful thing about web services is that the big companies have actually agreed on a useful standard.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About This Entry

This page contains a single entry from the blog posted on September 22, 2005 8:59 PM.

The previous post in this blog was Using BPEL with a VCS.

The next post in this blog is Invoking an EJB from BPEL using WSIF.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type and Oracle