Gathering a BPEL process's in and out parameters
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.
How to do it…
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.
- In the Oracle Enterprise Manager Console, we select the BPEL process from the tree, and click on the following icon:
- We receive information about the business process endpoint URI and a location of the business process WSDL as shown in the following screenshot:
- By entering the WSDL address into the web browser, we receive a description of the BPEL process interface. In this definition, we check for the input and output messages as follows:
<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>
- The most interesting part of WSDL is the
<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 theclient
namespace, which is defined as the XSD schema. We can find its location in WSDL under the<import>
tag. We search for theclient: process
input parameter in the XSD schema:<element name="process"> <complexType> <sequence> <element name="input" type="string"/> </sequence> </complexType> </element>
- As we can see, the input parameter takes the
string
variable with thename
input. Similarly, we explore the output parameterclient: processResponse
in the XSD schema as follows:<element name="processResponse"> <complexType> <sequence> <element name="result" type="string"/> </sequence> </complexType> </element>
- The BPEL process will return the
string
variable namedresult
.
How it works…
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.
Note
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.
See also
- To learn about the deployment of a BPEL process, refer to the previous recipe, Deploying a BPEL process