简体   繁体   English

将complexType复制到BPEL中的消息

[英]copy complexType to message in BPEL

I am using Apache ODE to write some simple BPEL's to connect 2 web services. 我正在使用Apache ODE编写一些简单的BPEL来连接2个Web服务。 One of the WSDL files of my two services contains this complex type: 我的两个服务的WSDL文件之一包含此复杂类型:

<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"? 如何从服务返回消息(只是xsd:string)到消息输入(在“ myObject”类型的“ str”内部)复制一个副本?

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. 规范<to variable="..." part="..." query="..."/>在BPEL 1.1或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> . 正确的等效表达式为: <to>$wsC_input.arg0/arg0/str</to><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. 当bpel中的默认名称空间与接收Web服务中的名称空间不同时,需要xmlns =“”。

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://ode.apache.org/faq.html

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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