Take control with WS-BPEL

Page: 1 2 3 4 5 6 7 December 11th, 2009 by Henri Bezemer

Here is the schema that will be imported in the front-end WSDL. The createCustomer element captures the data send from the customer (via the bank’s website) to the front-office WS-BPEL process:

front-office.xsd

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

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.zienit.com/front-office/schema"
    xmlns:tns="http://www.zienit.com/front-office/schema"
    elementFormDefault="qualified">
	<xsd:complexType name="createCustomer">
		<xsd:sequence>
			<xsd:element name="name" type="xsd:string"></xsd:element>
			<xsd:element name="street" type="xsd:string"></xsd:element>
			<xsd:element name="postalCode" type="xsd:string"></xsd:element>
			<xsd:element name="city" type="xsd:string"></xsd:element>
			<xsd:element name="email" type="xsd:string"></xsd:element>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:complexType name="createCustomerResponse">
		<xsd:sequence>
			<xsd:element name="id" type="xsd:int"></xsd:element>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:element name="createCustomer" type="tns:createCustomer"/>
	<xsd:element name="createCustomerResponse" type="tns:createCustomerResponse"/>
	<xsd:complexType name="notifyEmailConfirmed">
		<xsd:sequence>
			<xsd:element name="email" type="xsd:string"></xsd:element>
		</xsd:sequence>
	</xsd:complexType>
	<xsd:element name="notifyEmailConfirmed" type="tns:notifyEmailConfirmed"></xsd:element>
</xsd:schema>

The back-office schema is an interesting one. It has annotations that supply information for an encoder that is provided with the OpenESB platform. This customencoder-1.0 maps XML data to and from CSV style (or fixed-length) file formats. In this very simple example there are two “fields” defined, called id and name. Note that this encoder facility is not portable (not available in this specific form on other ESB platforms) unless you’re really lucky (see my earlier remarks about JBI portability). NetBeans provides a special extension that runs inside its XML schema editor and there’s also some documentation.

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://xml.netbeans.org/schema/back-office"
    xmlns:tns="http://xml.netbeans.org/schema/back-office"
    elementFormDefault="qualified" xmlns:enc="urn:com.sun:encoder">
	<xsd:annotation>
		<xsd:appinfo source="urn:com.sun:encoder">
			<enc:encoding name="Custom Encoding" namespace="urn:com.sun:encoder-custom-1.0" style="customencoder-1.0"/>
		</xsd:appinfo>
	</xsd:annotation>
	<xsd:element name="record">
		<xsd:annotation>
			<xsd:appinfo source="urn:com.sun:encoder">
				<urn:top xmlns:urn="urn:com.sun:encoder">true</urn:top>
				<urn:nodeProperties xmlns:urn="urn:com.sun:encoder-custom-1.0">
					<urn:nodeType>group</urn:nodeType>
					<urn:delimiterSet>
						<urn:level>
							<urn:delimiter>
								<urn:kind>normal</urn:kind>
								<urn:precedence>10</urn:precedence>
								<urn:optionalMode>never</urn:optionalMode>
								<urn:terminatorMode>never</urn:terminatorMode>
								<urn:bytes>
									<urn:constant>|</urn:constant>
								</urn:bytes>
							</urn:delimiter>
						</urn:level>
					</urn:delimiterSet>
				</urn:nodeProperties>
			</xsd:appinfo>
		</xsd:annotation>
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element name="id" type="xsd:int">
					<xsd:annotation>
						<xsd:appinfo source="urn:com.sun:encoder"/>
					</xsd:annotation>
				</xsd:element>
				<xsd:element name="name" type="xsd:string">
					<xsd:annotation>
						<xsd:appinfo source="urn:com.sun:encoder"/>
					</xsd:annotation>
				</xsd:element>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
</xsd:schema>

Next: prepare your WSDL’s!

Previous pageNext page

One Comment

December 15, 2009 at 11:12 am BPEL_evaluator

1

Thanks for the example. I now heve a better understanding of correlation Keep up th good work!