Uploaded image for project: 'ODE'
  1. ODE
  2. ODE-581

Problem with query expressions when assigning from variable to variable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.2
    • None
    • None
    • The attached test process is intended to be run against Ode 1.X. I have also seen this behavior on Ode 1.2, but it manifests itself differently.

    Description

      I have noticed that in some instances, when using a query expression to copy data from one variable to another, the Ode runtime will throw a selectionFailure fault. Replacing the variable query with an expression resolves the problem.

      I have put together a simple example of the problem I am seeing with query expressions. I tested this against a current build of Ode 1.X.

      The attached process takes a single int as input and returns a single string as output. Valid arguments for the input are 1, 2, or 3. The process should return "one", "two", or "three", depending on the input.

      The problem occurs when I try to assign values out of the RecordSet variable into the Record variable. When I use a query on the "to" side of the copy, the process will throw a selectionFailure fault at runtime. The process works correctly if you replace the queries with expressions. There are comments in the .bpel file that indicate where the problem occurs and how to resolve the problem by using an expression instead of a query.

      Test files follow:

                        • Begin QueryTest1.wsdl **********

      <?xml version="1.0"?>
      <definitions name="QueryTest1"
      targetNamespace="mynamespace"
      xmlns:tns="mynamespace"
      xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
      xmlns="http://schemas.xmlsoap.org/wsdl/"
      >

      <types>
      <schema attributeFormDefault="unqualified" elementFormDefault="qualified"
      targetNamespace="mynamespace"
      xmlns="http://www.w3.org/2001/XMLSchema">

      <element name="QueryTest1Request" type="int" />
      <element name="QueryTest1Response" type="string" />

      <complexType name="RecordType">
      <sequence>
      <element name="SomeValue" type="string"></element>
      <element name="AnotherValue" type="string"></element>
      </sequence>
      </complexType>

      <complexType name="RecordSetType">
      <sequence>
      <element ref="tns:Record" minOccurs="0" maxOccurs="unbounded"></element>
      </sequence>
      </complexType>

      <element name="Record" type="tns:RecordType"></element>
      <element name="RecordSet" type="tns:RecordSetType"></element>
      </schema>
      </types>

      <message name="QueryTest1RequestMessage">
      <part name="payload" element="tns:QueryTest1Request"/>
      </message>
      <message name="QueryTest1ResponseMessage">
      <part name="payload" element="tns:QueryTest1Response"/>
      </message>

      <portType name="QueryTest1">
      <operation name="process">
      <input message="tns:QueryTest1RequestMessage" />
      <output message="tns:QueryTest1ResponseMessage"/>
      </operation>
      </portType>

      <plnk:partnerLinkType name="QueryTest1">
      <plnk:role name="QueryTest1Provider" portType="tns:QueryTest1"/>
      </plnk:partnerLinkType>

      <binding name="QueryTest1Binding" type="tns:QueryTest1">
      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
      <operation name="process">
      <soap:operation soapAction="mynamespace/process" />
      <input>
      <soap:body use="literal" />
      </input>
      <output>
      <soap:body use="literal" />
      </output>
      </operation>
      </binding>

      <service name="QueryTest1Service">
      <port name="QueryTest1Port" binding="tns:QueryTest1Binding">
      <soap:address location="http://[server]:[port]/ode/QueryTest1" />
      </port>
      </service>
      </definitions>

                        • End QueryTest1.wsdl **********
                        • Begin QueryTest1.bpel **********

      <?xml version="1.0" encoding="UTF-8"?>
      <bpws:process exitOnStandardFault="yes"
      expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
      name="QueryTest1"
      queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
      suppressJoinFailure="yes" targetNamespace="mynamespace"
      xmlns:bpws="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
      xmlns:ode="http://www.apache.org/ode/type/extension"
      xmlns:tns="mynamespace" xmlns:xs="http://www.w3.org/2001/XMLSchema">

      <bpws:import importType="http://schemas.xmlsoap.org/wsdl/"
      location="QueryTest1.wsdl" namespace="mynamespace"/>

      <bpws:partnerLinks>
      <bpws:partnerLink myRole="QueryTest1Provider" name="client" partnerLinkType="tns:QueryTest1"/>
      </bpws:partnerLinks>

      <bpws:variables>
      <bpws:variable messageType="tns:QueryTest1RequestMessage" name="input"/>
      <bpws:variable messageType="tns:QueryTest1ResponseMessage" name="output"/>
      <bpws:variable element="tns:RecordSet" name="RecordSet"/>
      <bpws:variable element="tns:Record" name="Record"/>
      </bpws:variables>

      <bpws:sequence name="QueryTest1">
      <bpws:receive createInstance="yes" name="ReceiveInput"
      operation="process" partnerLink="client"
      portType="tns:QueryTest1" variable="input"/>
      <bpws:assign name="InitializeRecordSetVariable" validate="no">
      <bpws:copy>
      <bpws:from>
      <bpws:literal>
      <tns:RecordSet xmlns:tns="mynamespace"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="mynamespace QueryTest1.wsdl ">
      <tns:Record>
      <tns:SomeValue>one</tns:SomeValue>
      <tns:AnotherValue>ONE</tns:AnotherValue>
      </tns:Record>
      <tns:Record>
      <tns:SomeValue>two</tns:SomeValue>
      <tns:AnotherValue>TWO</tns:AnotherValue>
      </tns:Record>
      <tns:Record>
      <tns:SomeValue>three</tns:SomeValue>
      <tns:AnotherValue>THREE</tns:AnotherValue>
      </tns:Record>
      </tns:RecordSet>
      </bpws:literal>
      </bpws:from>
      <bpws:to variable="RecordSet"/>
      </bpws:copy>
      </bpws:assign>
      <bpws:assign name="InitializeRecordVariable" validate="no">
      <bpws:copy>
      <bpws:from>
      <bpws:literal>
      <tns:Record xmlns:tns="mynamespace"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="mynamespace QueryTest1.wsdl ">
      <tns:SomeValue/>
      <tns:AnotherValue/>
      </tns:Record>
      </bpws:literal>
      </bpws:from>
      <bpws:to variable="Record"/>
      </bpws:copy>
      </bpws:assign>
      <bpws:assign name="AssignRequestedRecordToVariable" validate="no">
      <bpws:copy>
      <bpws:from variable="RecordSet">
      <bpws:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![CDATA[tns:Record[number($input.payload)]/tns:SomeValue]]></bpws:query>
      </bpws:from>

      <!------------ Selection failure. ------------>
      <bpws:to variable="Record">
      <bpws:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![CDATA[tns:SomeValue]]></bpws:query>
      </bpws:to>

      <!------------ This works. ------------>
      <!-- <bpws:to expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![CDATA[$Record/tns:SomeValue]]></bpws:to> -->

      </bpws:copy>
      <bpws:copy>
      <bpws:from variable="RecordSet">
      <bpws:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![CDATA[tns:Record[number($input.payload)]/tns:AnotherValue]]></bpws:query>
      </bpws:from>

      <!------------ Selection failure. ------------>
      <bpws:to variable="Record">
      <bpws:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![CDATA[tns:AnotherValue]]></bpws:query>
      </bpws:to>

      <!------------ This works. ------------>
      <!-- <bpws:to expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![CDATA[$Record/tns:AnotherValue]]></bpws:to> -->

      </bpws:copy>
      </bpws:assign>
      <bpws:assign name="AssignFromVariableToOutput" validate="no">
      <bpws:copy>
      <bpws:from variable="Record">
      <bpws:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"><![CDATA[tns:SomeValue]]></bpws:query>
      </bpws:from>
      <bpws:to part="payload" variable="output"/>
      </bpws:copy>
      </bpws:assign>
      <bpws:reply name="ReplyWithOutput" operation="process"
      partnerLink="client" portType="tns:QueryTest1" variable="output"/>
      </bpws:sequence>

      </bpws:process>

                        • End QueryTest1.bpel **********
                        • Begin deploy.xml **********

      <?xml version="1.0" encoding="UTF-8"?>
      <deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03" xmlns:ns1="mynamespace">
      <process name="ns1:QueryTest1">
      <active>true</active>
      <provide partnerLink="client">
      <service name="ns1:QueryTest1Service" port="QueryTest1Port"/>
      </provide>
      </process>
      </deploy>

                        • End deploy.xml **********

      Attachments

        1. deploy.xml
          0.3 kB
          Jon Coogan
        2. QueryTest1.bpel
          5 kB
          Jon Coogan
        3. QueryTest1.wsdl
          3 kB
          Jon Coogan

        Activity

          People

            karthick Karthick Sankarachary
            joncoogan Jon Coogan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: