You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ode.apache.org by Rich Taylor <bh...@gmail.com> on 2007/07/27 00:15:06 UTC

Variable initialization question...

Possibly silly question about variable initialization.  When you want to
populate a variable with data do you first need to initialize the variable
with an empty/skeleton xml structure?  An example of what I mean is below.

If I don't assign a skeleton xml structure to the "output" variable using an
additional "copy"/" from literal" activity, I get the following from Ode
upon execution:
Error:
ERROR [ASSIGN]: Assignment Fault: {
http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure,lineNo=19
org.apache.axis2.AxisFault: {
http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure No
results for expression: {OXPath10Expression /tns:result}

The error makes sense since it's trying to execute an XPath against a
document that doesn't exist.  However I was thinking the BPEL engine would
automatically create the blank xml output document for me.   Seems like this
isn't the case.

Sorry, I realize this isn't Ode specific.   On an additional note, can
anyone suggest a good online forum for questions regarding the WSBPEL 2.0spec?

BPEL:
<?xml version="1.0" encoding="UTF-8"?>
<bpws:process exitOnStandardFault="yes" name="echo"
    suppressJoinFailure="yes"
    targetNamespace="urn:xmlns:test:composite-services"
    xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
xmlns:tns="urn:xmlns:test:composite-services">
    <bpws:import importType="http://schemas.xmlsoap.org/wsdl/"
        location="echo.wsdl" namespace="urn:xmlns:test:composite-services"/>
    <bpws:partnerLinks>
        <bpws:partnerLink myRole="echoProvider" name="client"
partnerLinkType="tns:echo"/>
    </bpws:partnerLinks>
    <bpws:variables>
        <bpws:variable messageType="tns:echoRequestMessage" name="input"/>
        <bpws:variable messageType="tns:echoResponseMessage" name="output"/>
    </bpws:variables>
    <bpws:sequence name="main">
        <bpws:receive createInstance="yes" name="receiveInput"
            operation="process" partnerLink="client" portType="tns:echo"
variable="input"/>
        <bpws:assign name="Assign" validate="no">
            <bpws:copy>
                <bpws:from><![CDATA["asdf"]]></bpws:from>
                <bpws:to part="payload" variable="output">
                    <bpws:query ><![CDATA[/tns:result]]></bpws:query>
                </bpws:to>
            </bpws:copy>
        </bpws:assign>
        <bpws:reply name="replyOutput" operation="process"
            partnerLink="client" portType="tns:echo" variable="output"/>
    </bpws:sequence>
</bpws:process>

Section from WSDL:
  <types>
        <schema attributeFormDefault="unqualified"
elementFormDefault="qualified"
                targetNamespace="urn:xmlns:test:composite-services"
                xmlns="http://www.w3.org/2001/XMLSchema">

            <element name="echoRequest">
                <complexType>
                    <sequence>
                        <element name="input" type="string"/>
                    </sequence>
                </complexType>
            </element>

            <element name="echoResponse">
                <complexType>
                    <sequence>
                        <element name="result" type="string"/>
                    </sequence>
                </complexType>
            </element>
        </schema>
    </types>

  <message name="echoRequestMessage">
        <part name="payload" element="tns:echoRequest"/>
    </message>
    <message name="echoResponseMessage">
        <part name="payload" element="tns:echoResponse"/>
    </message>

Re: Variable initialization question...

Posted by Alex Boisvert <bo...@intalio.com>.
Hi Rich,

On 7/26/07, Rich Taylor <bh...@gmail.com> wrote:
>
> Possibly silly question about variable initialization.  When you want to
> populate a variable with data do you first need to initialize the variable
> with an empty/skeleton xml structure?


Yes, but only if you're not assigning at the root of the variable content.


 An example of what I mean is below.
>
> If I don't assign a skeleton xml structure to the "output" variable using
> an
> additional "copy"/" from literal" activity, I get the following from Ode
> upon execution:
> Error:
> ERROR [ASSIGN]: Assignment Fault: {
>
> http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure,lineNo=19
> org.apache.axis2.AxisFault: {
> http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailureNo
> results for expression: {OXPath10Expression /tns:result}
>
> The error makes sense since it's trying to execute an XPath against a
> document that doesn't exist.  However I was thinking the BPEL engine would
> automatically create the blank xml output document for me.   Seems like
> this
> isn't the case.


This doesn't seem to be a good solution because it would only work in the
simplest cases...  You can't always infer the full path from an expression.


Consider, for example, expressions such as:
1) //bar    (all "bar" elements at any level)
2) /foo/bar[2] (the second "bar" element under foo;  what is the first??)
3)  /foo/bar[ text() = 'baz' ]  (using a predicate; what is the rest of the
structure?  how can engine create the content of the element to match the
expression?)
...
and it gets even more hairy with XPath 2.0.


Sorry, I realize this isn't Ode specific.   On an additional note, can
> anyone suggest a good online forum for questions regarding the WSBPEL
> 2.0spec?


Good question!  I'd also like to know if such a forum exist.  Otherwise, I
think this is a good forum.

alex