AnsweredAssumed Answered

Transformation of UEL in dataOutputAssociation

Question asked by franz13 on Mar 6, 2012
Hi,

I have a problem trying tranforming the result coming from a web service where the @WebResult is not defined.
Here is the WSDL file
<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions name="CounterService" targetNamespace="http://counter.webservice.impl.engine.activiti.org/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://counter.webservice.impl.engine.activiti.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <wsdl:types>
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://counter.webservice.impl.engine.activiti.org/" xmlns:tns="http://counter.webservice.impl.engine.activiti.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="inc" type="tns:inc"/>
  <xsd:complexType name="inc">
    <xsd:sequence/>
  </xsd:complexType>
  <xsd:element name="incResponse" type="tns:incResponse"/>
  <xsd:complexType name="incResponse">
    <xsd:sequence/>

  </xsd:complexType>
  <xsd:element name="reset" type="tns:reset"/>
  <xsd:complexType name="reset">
    <xsd:sequence/>
  </xsd:complexType>
  <xsd:element name="resetResponse" type="tns:resetResponse"/>
  <xsd:complexType name="resetResponse">
    <xsd:sequence/>
  </xsd:complexType>

  <xsd:element name="getCount" type="tns:getCount"/>
  <xsd:complexType name="getCount">
    <xsd:sequence/>
  </xsd:complexType>
  <xsd:element name="getCountResponse" type="tns:getCountResponse"/>
  <xsd:complexType name="getCountResponse">
    <xsd:sequence>
      <xsd:element name="count" type="xsd:int"/>
    </xsd:sequence>

  </xsd:complexType>
  <xsd:element name="setTo" type="tns:setTo"/>
  <xsd:complexType name="setTo">
    <xsd:sequence>
      <xsd:element name="value" type="xsd:int"/>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:element name="setToResponse" type="tns:setToResponse"/>
  <xsd:complexType name="setToResponse">

    <xsd:sequence/>
  </xsd:complexType>
  <xsd:element name="prettyPrintCount" type="tns:prettyPrintCount"/>
  <xsd:complexType name="prettyPrintCount">
    <xsd:sequence>
      <xsd:element minOccurs="0" name="prefix" type="xsd:string"/>
      <xsd:element minOccurs="0" name="suffix" type="xsd:string"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="prettyPrintCountResponse" type="tns:prettyPrintCountResponse"/>
  <xsd:complexType name="prettyPrintCountResponse">
    <xsd:sequence>
      <xsd:element minOccurs="0" name="return" type="xsd:string"/>
    </xsd:sequence>
  </xsd:complexType>
</xsd:schema>
  </wsdl:types>
  <wsdl:message name="prettyPrintCount">

    <wsdl:part element="tns:prettyPrintCount" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="inc">
    <wsdl:part element="tns:inc" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="incResponse">
    <wsdl:part element="tns:incResponse" name="parameters">

    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="getCountResponse">
    <wsdl:part element="tns:getCountResponse" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="setToResponse">
    <wsdl:part element="tns:setToResponse" name="parameters">
    </wsdl:part>

  </wsdl:message>
  <wsdl:message name="prettyPrintCountResponse">
    <wsdl:part element="tns:prettyPrintCountResponse" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="setTo">
    <wsdl:part element="tns:setTo" name="parameters">
    </wsdl:part>
  </wsdl:message>

  <wsdl:message name="getCount">
    <wsdl:part element="tns:getCount" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="reset">
    <wsdl:part element="tns:reset" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="resetResponse">

    <wsdl:part element="tns:resetResponse" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="Counter">
    <wsdl:operation name="inc">
      <wsdl:input message="tns:inc" name="inc">
    </wsdl:input>
      <wsdl:output message="tns:incResponse" name="incResponse">
    </wsdl:output>

    </wsdl:operation>
    <wsdl:operation name="reset">
      <wsdl:input message="tns:reset" name="reset">
    </wsdl:input>
      <wsdl:output message="tns:resetResponse" name="resetResponse">
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="getCount">
      <wsdl:input message="tns:getCount" name="getCount">

    </wsdl:input>
      <wsdl:output message="tns:getCountResponse" name="getCountResponse">
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="setTo">
      <wsdl:input message="tns:setTo" name="setTo">
    </wsdl:input>
      <wsdl:output message="tns:setToResponse" name="setToResponse">
    </wsdl:output>

    </wsdl:operation>
    <wsdl:operation name="prettyPrintCount">
      <wsdl:input message="tns:prettyPrintCount" name="prettyPrintCount">
    </wsdl:input>
      <wsdl:output message="tns:prettyPrintCountResponse" name="prettyPrintCountResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="CounterServiceSoapBinding" type="tns:Counter">

    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http'/>
    <wsdl:operation name="inc">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="inc">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="incResponse">
        <soap:body use="literal"/>
      </wsdl:output>

    </wsdl:operation>
    <wsdl:operation name="reset">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="reset">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="resetResponse">
        <soap:body use="literal"/>
      </wsdl:output>

    </wsdl:operation>
    <wsdl:operation name="getCount">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="getCount">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="getCountResponse">
        <soap:body use="literal"/>
      </wsdl:output>

    </wsdl:operation>
    <wsdl:operation name="setTo">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="setTo">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="setToResponse">
        <soap:body use="literal"/>
      </wsdl:output>

    </wsdl:operation>
    <wsdl:operation name="prettyPrintCount">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="prettyPrintCount">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="prettyPrintCountResponse">
        <soap:body use="literal"/>
      </wsdl:output>

    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="CounterService">
    <wsdl:port binding="tns:CounterServiceSoapBinding" name="CounterPort">
      <soap:address location="http://localhost:63081/counter'/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

Here is the BPMN specification

<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions"
  xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
  xmlns:activiti="http://activiti.org/bpmn"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  typeLanguage="http://www.w3.org/2001/XMLSchema"
  expressionLanguage="http://java.sun.com/products/jsp/"
  targetNamespace="org.activiti.engine.test.bpmn.servicetask"
  xmlns:tns="org.activiti.engine.test.bpmn.servicetask"
  xmlns:counter="http://webservice.activiti.org/">
  <!–
    XML Schema is used as type language for the model whereas the Java
    Unified Expression Language serves as language for Expressions.
  –>

  <import importType="http://schemas.xmlsoap.org/wsdl/"
          location="http://localhost:63081/counter?wsdl"
          namespace="http://webservice.activiti.org/" />
         
  <process id="webServiceInvocationWithDataFlowUEL">

   <!–
      The Data Inputs and Outputs of a Process have to be explicitly
      declared with their type to be valid BPMN 2.0
   –>
     <ioSpecification>
        <dataInput id="dataInputOfProcess" itemSubjectRef="tns:prettyPrintCountRequestItem" />
        <dataOutput id="dataOutputOfProcess" itemSubjectRef="xsd:string" />
        <inputSet>
           <dataInputRefs>dataInputOfProcess</dataInputRefs>
        </inputSet>
        <outputSet>
           <dataOutputRefs>dataOutputOfProcess</dataOutputRefs>
        </outputSet>
     </ioSpecification>
 
    <startEvent id="theStart" />
   
    <sequenceFlow id="flow1" sourceRef="theStart" targetRef="webService" />
   
    <serviceTask id="webService"
                 name="Web service invocation"
                 implementation="##WebService"
                 operationRef="tns:prettyPrintCountOperation">
            <!– The BPMN 2.0 Meta Model requires an Input/Output Specification –>
            <ioSpecification>
                <dataInput itemSubjectRef="tns:prettyPrintCountRequestItem" id="dataInputOfServiceTask" />
                <dataOutput itemSubjectRef="tns:prettyPrintCountResponseItem" id="dataOutputOfServiceTask" />
                <inputSet>
                    <dataInputRefs>dataInputOfServiceTask</dataInputRefs>
                </inputSet>
                <outputSet>
                   <dataOutputRefs>dataOutputOfServiceTask</dataOutputRefs>
                </outputSet>
            </ioSpecification>
            <dataInputAssociation>
                <sourceRef>dataInputOfProcess</sourceRef>
                <targetRef>dataInputOfServiceTask</targetRef>
               <assignment>
                  <from>${dataInputOfProcess.prefix}</from>
                  <to>${dataInputOfServiceTask.prefix}</to>
               </assignment>
               <assignment>
                  <from>${dataInputOfProcess.suffix}</from>
                  <to>${dataInputOfServiceTask.suffix}</to>
               </assignment>
            </dataInputAssociation>
            <dataOutputAssociation>
               <targetRef>dataOutputOfProcess</targetRef>
               <transformation>${dataOutputOfServiceTask.return}</transformation>
            </dataOutputAssociation>
    </serviceTask>
   
    <sequenceFlow id="flow2" sourceRef="webService" targetRef="waitState" />
   
    <receiveTask id="waitState" />
   
    <sequenceFlow id="flow3" sourceRef="waitState" targetRef="theEnd" />
   
    <endEvent id="theEnd" />
   
  </process>

  <!– Interface: implementationRef = QName of WSDL Port Type –>
  <interface name="Counter Interface" implementationRef="counter:Counter">
    <!– Operation: implementationRef = QName of WSDL Operation –>
    <operation id="prettyPrintCountOperation" name="prettyPrintCount Operation" implementationRef="counter:prettyPrintCount">
      <inMessageRef>tns:prettyPrintCountRequestMessage</inMessageRef>
      <outMessageRef>tns:prettyPrintCountResponseMessage</outMessageRef>
    </operation>
  </interface>
 
  <message id="prettyPrintCountRequestMessage" itemRef="tns:prettyPrintCountRequestItem" />
  <message id="prettyPrintCountResponseMessage" itemRef="tns:prettyPrintCountResponseItem" />
 
  <itemDefinition id="prettyPrintCountRequestItem" structureRef="counter:prettyPrintCount" /><!– QName of input element –>
  <itemDefinition id="prettyPrintCountResponseItem" structureRef="counter:prettyPrintCountResponse" /><!– QName of output element –>
 
</definitions>

If I try execute this specification in the engine, and I print the value contained in dataOutputOfProcess, it results null.

Obviously if I define an annotation in the web service (different by "result") it is correctly transformed and dataOutputOfProcess contains the correct value "The counter has the value -1. Good news"

Do you know if it is a know limitation?

Outcomes