Variables and XPath


As mentioned in Chapter 6, you prefix a BPEL variable name with a dollar sign ($) if you need to access data from that variable. If the variable is based directly on an XSD type, use a location path that skips the type name and (as appropriate) uses names declared in the type. For example, assume that the BPEL variable named applicant is directly based on the following XSD type:

 <xsd:complexType name="NameAddress">    <xsd:sequence>       <xsd:element name="first" type="xsd:string"                    minOccurs="1" />       <xsd:element name="last" type="xsd:string"                    minOccurs="1"/>    </xsd:sequence> </xsd:complexType> 

Here is the XPath expression for accessing the content of the variable field named last.

$applicant/last

Similarly, if the variable is based on an XSD element, use a location path that skips the element name and (as appropriate) uses names declared in the related XSD type. For example, assume that the BPEL variable named dmvResponse is directly based on the following XSD element.

 <xsd:element name="retrieveLicenseStatusResponse">    <xsd:complexType>       <xsd:sequence>          <xsd:element name="valid" type="xsd:boolean"/>       </xsd:sequence>    </xsd:complexType> </xsd:element> 

Here is the XPath expression for accessing the content of the variable field named valid.

$dmvResponse/valid

A variation occurs if the variable is based on a WSDL message definition. To derive the variable name used in the XPath expression, prefix the BPEL variable name with a dollar sign. Then, add a period and the name of a message part.

Assume that the BPEL variable named dmvResponse is based on the following WSDL message definition, which refers to the same XSD element as mentioned in the previous example.

 <wsdl:message name="retrieveLicenseStatusResponseMsg">    <wsdl:part name="retrieveLicenseStatusResult"               element="retrieveLicenseStatusResponse"/> </wsdl:message> 

Here is the XPath expression for accessing the content of the variable field named valid.

 $dmvResponse.retrieveLicenseStatusResult/valid 

As shown, you use a location path that skips the XSD element name specified in the WSDL message definition.




SOA for the Business Developer. Concepts, BPEL, and SCA
SOA for the Business Developer: Concepts, BPEL, and SCA (Business Developers series)
ISBN: 1583470654
EAN: 2147483647
Year: 2004
Pages: 157
Authors: Ben Margolis

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net