Impossible itself says "I M Possible" :) RAGHUVIR's Techonloy Blog..

Friday Nov 13, 2009

Here I want to write steps to create a user defined fault  using open-esb's BPEL .  The fault having child elements in detail section.

 In the example , I create a "uninitialized variable" fault and catch it and send it as response. 

 Here are detailed steps :-

1) Create a BPEL process named "FaultUserDefined_Bpel" .

2) Create a simple receive - assign - reply ( drag these from the palette ).

3) Create a XSD with 2 elements :-

<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://xml.netbeans.org/schema/faultxsd"
    xmlns:tns="http://xml.netbeans.org/schema/faultxsd"
    elementFormDefault="qualified">
    <xsd:element name="faultdesc" type="tns:soapDetail"/>
    <xsd:complexType name="soapDetail">
        <xsd:sequence>
            <xsd:element name="soapfaultName" type="xsd:string"/>
            <xsd:element name="soapfaultdesc" type="xsd:string"/>
        </xsd:sequence>
    </xsd:complexType>
</xsd:schema>

4) Create a SOAP  WSDL  - RPC literal with fault part as "fault1" and data type is the complex type created in step 3 , i.e. "soapDetail" and part1 as "in" (request) and part1 as "out"(response)

5) Drag the WSDL in the BPEL canvas as partnerlink1 .

 6) Connect the wsdl to receive , reply to wsdl

7) Create a variable using "add variable" button right above the bpel canvas .data type "integer"

8) Double click the assign and assign in to out and use concat to use the newly created variable. Notice that we are using the variable without initialization. So it should throw "Uninitialized variable exception"

9) Now create a "Fault Handler" and add a "catch" and select "catch" and change it Fault name property to "uninitializedVariable" in Standard faults.  Click OK

10) Inside the "catch" drop a "assign" and "reply" .

11) Double click the "assign" and add some string literals to "soapfaultName" and "soapfaultdesc".

12) Double click the "reply" and assign back to the wsdl but change the response as Fault Response . Choose the Fault Name as "fault1" as created in the wsdl. and create a fault variable using the "create" button.

User defined SOAP fault implemented using BPEL in OpenESB

13) Build and check if the BPEL has any errors .

14) Add a composite app , drop the BPEL process to the CASA editor and build and deploy the composite app.

15) Create a new test case , send request and observe the response as fault coming as user defined .

You can get the project here


Comments:

Post a Comment:
  • HTML Syntax: NOT allowed