Wednesday, April 30, 2008

How to change Input/Output Variable for a BPEL Process

When you create a BPEL process project it asks for input and output XSD elements, you can choose your input and output elements over there. Once you are finish with the project creation you can start designing BPEL flow using the IDE. It is the ideal scenario where you have your input and output XML schema's defined before starting development of BPEL process and these schema's won't require any modifications in the future. But in the real life scenarios it rarely happens. Any change in requirements or policies impacts input and output XML schema's. Sometimes you need to change input and output schema elements for a BPEL process.

Changing input or output XML schema element types is really a challenge in JDeveloper. You need to check for the impact of these changes. JDeveloper doesn't give any feature to update all the artifacts impacted by any changes in the input/output XSD elements. You need to modify all the impacted artifacts manually.

Every BPEL process is exposed as a web service using WSDL so you need to change the WSDL first. If you need to use input/output elements from an XSD or WSDL file, you need to import the XSD or WSDL in your BPEL process project WSDL.

To import a WSDL use the following statement:

<import namespace="Namespace of WSDL" location="WSDL Location"/>

To import an XSD use the following statement:

<types>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:import namespace="Namespace of XSD" schemaLocation="XSD Location"/>

</xsd:schema>

</types>

Delete all the <import> statements having unused XSD's or WSDL's. Make sure that all the imported XSD's and WSDL's doesn't have duplicate elements and you are not importing any WSDL, XSD more than one time, otherwise you will get ORABPEL-10902 error while compiling the BPEL process project.

Next step is to change the input/output element type. If you are importing a WSDL for input/output element you need to change the input and output message for the desired operation. e.g.

<operation name="process">

<input message="prefix:Message Type"/>

<output message="prefix:Message Type"/>

</operation>

If you are importing an XSD for input/output element you need to change the element name in the message part for request and response messages.

<message name="YourProcessNameRequestMessage">

<part name="payload" element="prefix:Element Name"/>

</message>

<message name="YourProcessNameResponseMessage">

<part name="payload" element="prefix:Element Name"/>

</message>

Make sure that you are providing the correct elements and you are using the correct namespaces otherwise you will get ORRABPEL-10902 error with the following message:

[Error ORABPEL-10902]: compilation failed [Description]: in "bpel.xml", XML parsing failed because "undefined part element.

Validate your BPEL flow, compile it and deploy it on the server.

1 comment:

Vaibhav Pandey said...

nice and helpful blog........thnx Sam :)