在BPEL返回复杂类型响应 [英] Returning complex type response at BPEL
问题描述
基本上,我希望能够从BPEL ODE引擎生成具有复杂类型且元素数量不受限制的响应. 这个想法非常基础,我得到一个对象列表作为输入,然后根据某个类别进行一些过滤.然后,我需要基于过滤来生成响应,该响应可能不止一个元素.但是BPEL副本分配仅允许一对一分配. 我已经尝试使用数组,但似乎也无法分配给多个元素. 下面的代码段同时用于输入和输出.
Basically I want to be able to generate a response from BPEL ODE engine with complex type that has an unbounded number of elements. The idea is very basic, I get a list of objects as an input then I do some filtering based on a certain category. Then I need to generate response based on the filtering, which might be more than one elements. But the BPEL copy assignment only allow one to one assignment. I already try using array but can't seem to assign to more than one element also. The snippets below is for both the input and the output.
<complexType name="hospitalType">
<sequence minOccurs="1" maxOccurs="unbounded">
<element name="patients">
<complexType>
<sequence>
<element name="patient" minOccurs="1" maxOccurs="unbounded">
<complexType>
<sequence>
<element type="string" name="name"/>
<element type="date" name="dob"/>
<element type="byte" name="age"/>
<element type="string" name="status"/>
</sequence>
<attribute name="pid" type="ID"/>
</complexType>
</element>
</sequence>
</complexType>
</element>
到目前为止,以下是我尝试过的
So far the following is what I tried
<bpel:copy>
<bpel:from part="payload" variable="input">
<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
<![CDATA[tns:patients/tns:patient[1]]]>
</bpel:query>
</bpel:from>
<bpel:to part="inload" variable="output">
<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
<![CDATA[tns:patients/tns:patient]]>
</bpel:query>
</bpel:to>
</bpel:copy>
如果输入中有多个元素,我什至无法做简单的分配.
I can't even do a simple assignment if the input has more than one element..
推荐答案
这是WS-BPEL的局限性.实现此目标的符合标准的方法是运行XSL转换.请参见 WS-BPEL规范的第65页.为了使操作更容易一些,ODE提供了几个XPath扩展,它们允许在列表中添加或插入元素.请参阅此处以获取列表.这样的分配示例如下:
This is a limitation of WS-BPEL. The standards compliant way to achieve this is to run an XSL tranformation. See page 65 of the WS-BPEL specification. To make this a little easier, ODE provides a couple of XPath extensions that allow for appending or inserting elements into a list. See here for a list. An example of such an assign looks as follows:
<assign>
<copy>
<from>ode:insert-after($parent, $parent/child::node(), $siblings)</from>
<to variable="parent"/>
</copy>
</assign>
这篇关于在BPEL返回复杂类型响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!