Hello Mark, Thank you for your deteiled reply which solved my confusion completely.
Yes the first choice you pointed out is proper to initialize a complex variable. I had falsely understood the relation between "literal variant of copy" and "TII -> EII". As to my example, the first copy should be: <copy> <from><literal> <svc01:elemB xmlns:svc01="http://example.com/service01.wsdl"> <svc01:elemC/> </svc01:elemB> </literal></from> <to>$_b</to> </copy> rather than <copy> <from><literal><svc01:elemC xmlns:svc01="http://example.com/service01.wsdl"/></literal></from> <to>$_b</to> </copy> Hope it helpful to others. Thanks again. On Mon, Apr 6, 2009 at 9:49 PM, Ford, Mark <mark.f...@ll.mit.edu> wrote: > The BPEL spec only addresses copy operations. As such, the to-spec for the > copy operation must result in a target node that exists. A TII -> EII copy > operation will never result in the creation of a child element in the target > node. The result will be the target element having a single child text node, > not an element node. > > What you have run into is a valid exception being thrown because your second > copy operation is targeting a node that does not exist in the variable $_b. > After the first copy operation, the contents of $_b are: > > <svc01:elemC/> > > You are attempting to copy $_c into a child of $_b that doesn't exist. For > example: > > <svc01:elemC> > <svc01:elemC/> <!-- This is the node you're targeting --> > <scv01:elemC> > > The quote from the spec that you referenced pertains to the literal variant > of the copy operation. With this variant, the from-spec must produce a single > EII or a single TII. In your case, you are producing a single EII which is > valid. Therefore it is not a TII -> EII copy operation, it's actually an EII > -> EII copy operation. > > Your choices are (in no particular order): > > * initialize the entire target variable using the complete element in the > literal from-spec > * use extensions to dynamically create missing target nodes > * use Xquery expressions in the from-spec to construct the complex > variable dynamically in a simple EII -> EII copy op to update the whole > variable or parts of it. > > On 4/6/09 4:19 AM, "ZHAO Wenfeng" <zhaowenf...@gmail.com> wrote: > > 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 > > > > > -- > Mark Ford > MIT Lincoln Laboratory > 244 Wood Street > Lexington MA 02420 > (781) 981-1843 > Regards Wenfeng --------------------- Zhao, Wenfeng http://www.bupt.edu.cn