According to WS-BPEL(Version 2.0) specification, it seems that the "TII -> EII"
type of copy can be used to initialize a complex variable - at least to create
its first children. The section "8.4.2. Replacement Logic of Copy Operations"
says(P.70):
"To replace the destination content:
If the destination is an EII, all [children] properties (if any) are
removed and the source content TII is added as the child of the EII. "
But ODE 2.0 seems not to comply with it because in my case the assignment:
<copy>
<from><literal><svc01:elemC
xmlns:svc01="http://example.com/service01.wsdl"/></literal></from>
<to>$_b</to>
</copy>
<copy xmlns:svc01="http://example.com/service01.wsdl">
<from>$_c</from>
<to>$_b/svc01:elemC</to>
</copy>
will incur selectionFailure:
ERROR - GeronimoLog.error(104) | Assignment Fault: {http://docs.oasis-open.org/w
sbpel/2.0/process/executable}selectionFailure,lineNo=98,faultExplanation={http:/
/docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure: No results
for expression: {OXPath10Expression $_b/svc01:elemC}
But alternatively, using the XPath extention fuction insert-as-last-into()
provided by ODE, the above initialization can be accomplished.
The version of ODE I use is ODE 2.0 Build #87 (2009-1-8 2:25:04). The
declaration of the variables is as:
<variables xmlns:ws0="http://example.com/service01.wsdl">
... ...
<variable name="_a" element="ws0:elemA" />
<variable name="_b" element="ws0:elemB" />
<variable name="_c" element="ws0:elemC" />
<variable name="_a2" element="ws0:elemA2" />
</variables>
And the schema is:
<schema targetNamespace="http://example.com/service01.wsdl"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
... ...
<element name="ResultInfo">
<complexType>
<sequence>
<element name="elemA">
<complexType>
<sequence>
<element name="elemB">
<complexType>
<sequence>
<element name="elemC" type="string"
maxOccurs="unbounded"/>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
<element name="elemA2" type="string"/>
</sequence>
</complexType>
</element>
</schema>
The complete file set is in the attachment.
If this disagreement in ODE is not a bug but a intentional design, I guess the
reason is that, according to WS-BPEL, even if it is supported, only the first
child can be created and the creation of other children must appeal to some
extension mechanism. See "8.4 Assignment"(P.62):
"The fifth from-spec variant returns values as if it were a from-spec that
selects the children of the <literal> element in the WS-BPEL source code.
[SA00038] The return value MUST be a *single* EII or Text Information Item
(TII) only."
Am I right?
Thanks & Regards
Wenfeng
----------
ZHAO Wenfeng
http://www.bupt.edu.cn