简体   繁体   中英

copy complexType to message in BPEL

I am using Apache ODE to write some simple BPEL's to connect 2 web services. One of the WSDL files of my two services contains this complex type:

<types>
<t:schema targetNamespace="http://ws.panos.com/" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <t:complexType name="myObject">
   <t:sequence>
     <t:element minOccurs="0" name="str" type="t:string" />
   </t:sequence>
 </t:complexType>
</t:schema>

How do I make a copy from a service return message (which is just a xsd:string) to the input of a message (inside "str" of type "myObject"?

I have tried to do this, but doesnt seem to work:

<assign name="assign_2">
<copy> 
    <from variable="wsA_output" part="return"/>
    <to variable="wsC_input" part="arg0" query="/arg0/str"/> 
</copy> 

I always get a null string transfered. Help much appreciated.

The to-spec <to variable="..." part="..." query="..."/> is not valid in BPEL 1.1 nor BPEL 2.0. The correct equivalent expression is: <to>$wsC_input.arg0/arg0/str</to> or <to variable="wsC_input" part="arg0"><query>/arg0/str</query></to> . Please make also sure that you initialize the variable before assigning values to nested structures.

Just found the mistake. You are right, we need to query in order to find the field like this:

 <assign name="assign_2">
<copy> 
    <from variable="wsA_output" part="return"/>
            <to>$wsC_input.message/arg0/str</to>
</copy> 
</assign>

Also, we need to initialize the variable like this:

 <assign name="assign_init">
<copy> 
    <from>
        <literal><arg0><str xmlns="">nothing</str></arg0></literal>
    </from>
    <to variable="wsC_input" part="arg0"></to>
</copy> 
 </assign>

The xmlns="" is needed when the default namespace in your bpel is different that the namespace in the receiving web service.

I am just writing these down for future reference :)

Again, thanks for you your answer.

Some links that could also help other people:

http://ode.apache.org/faq.html

http://jee-bpel-soa.blogspot.com/2009/08/manipulating-ws-bpel-variables-and.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM