Unfortunately it doesn't work.

I've looked at the ASSIGN class and it is impossible to assign to a
variable a sequence longer than 1:

ASSIGN.java
private Node evalRValue(OAssign.RValue from) throws FaultException,
ExternalVariableModuleException {
(...)

        } else if (from instanceof OAssign.Expression) {
            List<Node> l;
            OExpression expr = ((OAssign.Expression) from).expression;
            try {
                l =
getBpelRuntimeContext().getExpLangRuntime().evaluate(expr,
getEvaluationContext());
            } catch (EvaluationException e) {
                String msg = __msgs.msgEvalException(from.toString(),
e.getMessage());
                if (__log.isDebugEnabled()) __log.debug(from + ": " +
msg);
                if (e.getCause() instanceof FaultException) throw
(FaultException)e.getCause();
                throw new
FaultException(getOAsssign().getOwner().constants.qnSelectionFailure,
msg);
            }
            if (l.size() == 0) {
                String msg =
__msgs.msgRValueNoNodesSelected(expr.toString());
                if (__log.isDebugEnabled()) __log.debug(from + ": " +
msg);
                throw new
FaultException(getOAsssign().getOwner().constants.qnSelectionFailure,
msg, new Throwable("ignoreMissingFromData"));
            } else if (l.size() > 1) {
                String msg =
__msgs.msgRValueMultipleNodesSelected(expr.toString());
                if (__log.isDebugEnabled()) __log.debug(from + ": " +
msg);
                throw new
FaultException(getOAsssign().getOwner().constants.qnSelectionFailure,
msg);
            }
            retVal = (Node) l.get(0);
        }
(...)
}

So I had to solve the problem by using fn:string-join and fn:tokenize.
If you have any other workaround please let me know

-- 
Regards,
Mateusz Nowakowski

> -----Original Message-----
> From: David Carver [mailto:[email protected]]
> Sent: Sunday, May 16, 2010 5:21 AM
> To: [email protected]
> Subject: Re: BPEL variable type for sequences of simple type
> 
> Have you tried an xs:anyType?   If you are using XPath, that should
> allow you to get Nodes stored into the variable.  You can't store
> multiple nodes as a String value.
> 
> http://www.w3.org/TR/xmlschema-0/#anyType
> 
> 
> 
> On 05/15/2010 03:13 PM, Nowakowski, Mateusz wrote:
> > Hi,
> >
> > What BPEL variable type should I use for a sequence of simple types?
> >
> > I have a situation where I'd like to save into variable a result of
> > XPath $Request.body/xsd1:SomeElement/xsd1:ManyChildren/@Code which
is
> a
> > sequence of several strings.
> >
> > When I specify a variable like this:
> > <bpel:variable name="Codes" type="xs:string"/>
> >
> > I've got a selection failure:
> > 2010-05-15 22:53:03,465 [pool-5-thread-44] DEBUG
> > org.apache.ode.bpel.elang.xpath20.runtime.XPath20ExpressionRuntime -
> > Expression {OXPath10Expression
> > $Request.body/xsd1:SomeElement/xsd1:ManyChildren/@Code} generated
> result
> > net.sf.saxon.dom.domnodel...@1f81137 -
> type=net.sf.saxon.dom.DOMNodeList
> > 2010-05-15 22:53:03,465 [pool-5-thread-44] DEBUG
> > org.apache.ode.bpel.elang.xpath20.runtime.XPath20ExpressionRuntime -
> > Returned node list of size 2
> > 2010-05-15 22:53:03,465 [pool-5-thread-44] DEBUG
> > org.apache.ode.bpel.runtime.ASSIGN - {OXPath10Expression
> > $Request.body/xsd1:SomeElement/xsd1:ManyChildren/@Code}: R-Value
> > expression "{OXPath10Expression
> > $Request.body/xsd1:SomeElement/xsd1:ManyChildren/@Code}" returned
> > multiple nodes.
> > 2010-05-15 22:53:03,465 [pool-5-thread-44] INFO
> > org.apache.ode.bpel.runtime.ASSIGN - Assignment Fault:
> > {http://docs.oasis-
> open.org/wsbpel/2.0/process/executable}selectionFailu
> > re,lineNo=1115,faultExplanation=R-Value expression
> "{OXPath10Expression
> > $Request.body/xsd1:SomeElement/xsd1:ManyChildren/@Code}" returned
> > multiple nodes.
> > 2010-05-15 22:53:03,465 [pool-5-thread-44] DEBUG
> > org.apache.ode.bpel.runtime.SCOPE - ({OScope
> > 'scope-implicit-scope-line-856'
> > id=183},TerminationChannel#28,ParentScopeChannel#30): has a fault
> > handler for
> > {http://docs.oasis-
> open.org/wsbpel/2.0/process/executable}selectionFailu
> > re: {OCatch faultName=null, faultVariable=null}
> >
> >
> >

Reply via email to