[jboss-user] [JBoss jBPM] - [bpel] XPATH in <assign> element

rainstar79 do-not-reply at jboss.com
Thu Jul 5 04:11:34 EDT 2007


Hi BPEL folks,
I have a question regarding the assign-element. 
I modeled a simple BPEL process, where the input is an array of xsd:anyURI and the output should be a string of the e.g. the third element of this anyURI array. I assume, I have some problems withe the XPATH expression in the assign element.

This is the bpel file:


  | <?xml version="1.0" encoding="UTF-8"?>
  | <process name="HelloWorld" targetNamespace="urn:samples:review"
  | 	xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
  | 	xmlns:tns="urn:samples:review"
  | 	xmlns:char="http://services.planets-project.eu/ifr/characterisation"
  | 	xmlns:rep="http://services.planets-project.eu/ifr/reporting"
  | 	xmlns:bpel="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
  | 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  | 	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  | 	xmlns:array="http://jaxb.dev.java.net/array"
  | 	xsi:schemaLocation="http://schemas.xmlsoap.org/ws/2003/03/business-process/
  |       http://schemas.xmlsoap.org/ws/2003/03/business-process/">
  | 
  | 	<partnerLinks>
  | 		<!-- establishes the relationship with the caller agent -->
  | 		<partnerLink name="caller" partnerLinkType="tns:Greeter-Caller"
  | 			myRole="Greeter" />
  | 
  | 	</partnerLinks>
  | 
  | 	<variables>
  | 		<!-- holds the incoming message -->
  | 		<variable name="request" messageType="tns:nameMessage" />
  | 		<!-- holds the outgoing message -->
  | 		<variable name="response" messageType="tns:greetingMessage" />
  | 		<variable name="dummy" type="xsd:anyURI" />
  | 
  | 	</variables>
  | 
  | 	<sequence>
  | 
  | 		<!-- receive the name of a person -->
  | 		<receive operation="sayHello" partnerLink="caller"
  | 			portType="tns:Greeter" variable="request" createInstance="yes" />
  | 
  | 		<!-- Assign the final Report to the output variable -->
  | 		<assign>
  | 			<copy>
  | 				<from variable="request" expression="name/array:item[3]" />
  | 				<to variable="response" part="greeting" />
  | 			</copy>
  | 		</assign>
  | 
  | 		<!-- reply with the greeting -->
  | 		<reply operation="sayHello" partnerLink="caller"
  | 			portType="tns:Greeter" variable="response" />
  | 	</sequence>
  | 
  | </process>
  | 


and this is the wsdl File:


  | <?xml version="1.0" encoding="UTF-8"?>
  | <definitions targetNamespace="urn:samples:review"
  |   xmlns="http://schemas.xmlsoap.org/wsdl/"
  |   xmlns:tns="urn:samples:review"
  |   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  |   xmlns:plt="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"
  |   xmlns:char="http://services.planets-project.eu/ifr/characterisation"
  |   xmlns:rep="http://services.planets-project.eu/ifr/reporting"
  |   xmlns:array="http://jaxb.dev.java.net/array"
  | >
  |       
  |  
  | <types>
  |   <xs:schema targetNamespace='http://jaxb.dev.java.net/array' version='1.0' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
  |    
  |    <xs:complexType final='#all' name='anyFileURIArray'>
  |     <xs:sequence>
  |      <xs:element maxOccurs='unbounded' minOccurs='0' name='item' nillable='true' type='xs:anyURI'/>
  |     </xs:sequence>
  |    </xs:complexType>
  |    
  |   </xs:schema>
  |  </types>
  | 
  |   <!-- characterizes the relationship between the greeter and its caller -->
  |   <plt:partnerLinkType name="Greeter-Caller">
  |     <plt:role name="Greeter" portType="tns:Greeter"/>
  |   </plt:partnerLinkType>
  |   
  | 	
  |   <!-- carries the name of a person -->
  |   <message name="nameMessage">
  |     <part name="name" type="array:anyFileURIArray" />
  |   </message>
  | 
  |   <!-- carries the greeting -->
  |   <message name="greetingMessage">
  |     <part name="greeting" type="xsd:string" />
  |   </message>
  | 
  |   <!-- describes the interface presented to callers -->
  |   <portType name="Greeter">
  |     <operation name="sayHello">
  |       <input message="tns:nameMessage" />
  |       <output message="tns:greetingMessage" />
  |     </operation>
  |   </portType>
  | 
  | </definitions>
  | 

The SOAP request of the deployed workflow is as followed:


  | <ns1:sayHello xmlns:ns1="urn:samples:review">
  |   <name><item>file.doc</item>
  | <item>file1.gif</item>
  | <item>file2.doc</item>
  | <item>file3.jpg</item>
  | <item>file4.doc</item>
  | <item>file5.doc</item>
  | <item>file6.gif</item>
  | <item>file7.doc</item>
  | <item>file8.doc</item></name>
  | </ns1:sayHello>
  | 

and here is the result I get, which does not include the third element (-->file2.doc) :(


  | <?xml version="1.0" encoding="UTF-8"?>
  | <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
  |   <env:Header />
  |   <env:Body>
  |     <ns1:sayHelloResponse xmlns:ns1="urn:samples:review">
  |       <greeting />
  |     </ns1:sayHelloResponse>
  |   </env:Body>
  | </env:Envelope>
  | 
  | 
  | 

Thanks for your help!!! Maybe you can provide me with an example how to use XPATH expressions!!!

Cheers Rainer

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4060692#4060692

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4060692



More information about the jboss-user mailing list