This recipe will explain the ways of getting input and output parameters about a BPEL process. The information gathered is very important if we want to call the BPEL process from Java applications.
We are deploying the BPEL process on the BPEL server. The business process is now ready to be executed; however, we don't have any information about the business process besides the WSDL location of the business process.
<wsdl: message name = "HelloWorldProcessRequestMessage"> <wsdl: part name = "payload" element = "client:process"/> </wsdl: message> <wsdl: message name = "HelloWorldProcessResponseMessage"> <wsdl: part name = "payload" element = "client: processResponse"/> </wsdl: message> <wsdl: portType name = "HelloWorldProcess"> <wsdl: operation name = "process"> <wsdl: input message = "client: HelloWorldProcessRequestMessage"/> <wsdl: output message = "client:HelloWorldProcessResponseMessage"/> </wsdl:operation> </wsdl:portType>
<wsdl:operation>
element, which indicates the entry point, the functionality, and the input and output messages of the BPEL process. We see that the input and output parameters both have a defined message in the client
namespace, which is defined as the XSD schema. We can find its location in WSDL under the <import>
tag. We search for the client: process
input parameter in the XSD schema:<element name="process"> <complexType> <sequence> <element name="input" type="string"/> </sequence> </complexType> </element>
string
variable with the name
input. Similarly, we explore the output parameter client: processResponse
in the XSD schema as follows:<element name="processResponse"> <complexType> <sequence> <element name="result" type="string"/> </sequence> </complexType> </element>
string
variable named result
.In general, there are two approaches to designing the BPEL processes. The first one is the top-down approach, where we first develop the XSD schema and WSDL files, which is also called the contract-first approach . The next one is called the bottom-up approach, where we start from the already-written Java code and generate the XSD schema and WSDL files with tools.
The recommended approach when designing the BPEL processes is to first define the XSD schema, which contains the definition of the input and output parameters. This is also the proper place to put the various complex variables used in the business process.
The schema is later used by WSDL to define the BPEL process interface via the <wsdl: portType>
element. Both WSDL and the XSD schema are packed into the deployment package and deployed to the BPEL server.
The definition of the input and output parameters in the XSD schema is not mandatory. We can easily define them in WSDL of the BPEL process. However, we lose some of the readability of the WSDL document. Note that such an approach is bad practice and is not recommended, since it hinders the reusability of the XML data types and elements.