This discussion is archived
12 Replies Latest reply: May 6, 2013 5:25 AM by samaan_filho1 RSS

Wrong initialization of outputVariable

samaan_filho1 Newbie
Currently Being Moderated
I´m facing a problem on outputVariable, in BPEL version 11.1.1.5.

In my response I have 2 elements: elem1 and elem2. Depending on the input, I have to set elem1 or elem2, but the response always come with both elements.

In some tests, I initialize the outputVariable with $outputVariable, just to see on the Audit Trail, and in the begining of the process, the outputVariable alrealy have the elem1 and elem2.

If I remove the Assing of one of the elements, on the initialization, the output doesn´t show the correspondent element.

To solve this issue, I have to remove both elements on the begining of the process.

Does anybody have a clue of this problem?
  • 1. Re: Wrong initialization of outputVariable
    vladodias Guru
    Currently Being Moderated
    Check your XSD... Have a look at XSD indicators... minOccurs or choice should solve your case...
    http://www.w3schools.com/schema/schema_complex_indicators.asp

    Cheers,
    Vlad
  • 2. Re: Wrong initialization of outputVariable
    samaan_filho1 Newbie
    Currently Being Moderated
    Both elements are optional.

    as i told, if i remove the assign at the end of the process, the output Variable START without the respective element. but if i put a assign a assign, the variable initiate with the element, then, i have to remote it manually...

    it doesn't seem to be a XSD issue... it looks like a BPEL bug or something.

    Edited by: samaan_filho1 on 30/04/2013 03:50
  • 3. Re: Wrong initialization of outputVariable
    vladodias Guru
    Currently Being Moderated
    Kindly post the source view of your assign...
  • 4. Re: Wrong initialization of outputVariable
    samaan_filho1 Newbie
    Currently Being Moderated
    Some code:

    The Request and response:

    <complexType name="ComplexType1">
    <sequence>
    <element name="codigoCt1" type="long" minOccurs="0"/>
    </sequence>
    </complexType>

    <complexType name="ComplexType2">
    <sequence>
    <element name="codigoCt2" type="long" minOccurs="0"/>
    </sequence>
    </complexType>

    <complexType name="operationRequest">
    <sequence>
    <element name="codigo" type="long" maxOccurs="1" minOccurs="0"></element>
    </sequence>
    </complexType>

    <complexType name="operationResponse">
    <sequence>
    <element name="elem1" type="ns1:ComplexType1" maxOccurs="1" minOccurs="0"></element>
    <element name="elem2" type="ns1:ComplexType2" maxOccurs="1" minOccurs="0" nillable="true"/>
    </sequence>
    </complexType>

    The 1st example, without any assing:

    <variables>
    <!-- Reference to the message passed as input during initiation -->
    <variable name="inputVariable" messageType="ns1:BuscarLaudoPorFichaIdiomaRequest"/>

    <!-- Reference to the message that will be returned to the requester-->
    <variable name="outputVariable" messageType="ns1:BuscarLaudoPorFichaIdiomaResponse">
    <from variable="outputVariable"/>
    </variable>
    </variables>

    <sequence name="main">

    <!-- Receive input from requestor. (Note: This maps to operation defined in BPELProcess1.wsdl) -->
    <receive name="receiveInput" partnerLink="bpelprocess1_client" portType="ns1:ResultadoLegadoENT" operation="BuscarLaudoPorFichaIdioma" variable="inputVariable" createInstance="yes"/>

    <!-- Generate reply to synchronous request -->
    <reply name="replyOutput" partnerLink="bpelprocess1_client" portType="ns1:ResultadoLegadoENT" operation="BuscarLaudoPorFichaIdioma" variable="outputVariable"/>
    </sequence>

    In the Audit Trail, the inicialization of the outputVariable is:

    <outputVariable>
    <part name="parameters">
    <operationResponse/>
    </part>
    </outputVariable>

    And the response is:

    <outputVariable>
    <part name="parameters">
    <operationResponse/>
    </part>
    </outputVariable>

    In the 2nd example, I added an if and 2 assigns:

    <sequence name="main">

    <!-- Receive input from requestor. (Note: This maps to operation defined in BPELProcess1.wsdl) -->
    <receive name="receiveInput" partnerLink="bpelprocess1_client" portType="ns1:ResultadoLegadoENT" operation="BuscarLaudoPorFichaIdioma" variable="inputVariable" createInstance="yes"/>

    <!-- Generate reply to synchronous request -->
    <if name="If1">
    <condition>$inputVariable.parameters/ns2:codigo=1</condition>
    <assign name="Assign1">
    <copy>
    <from>$inputVariable.parameters/ns2:codigo</from>
    <to>$outputVariable.parameters/ns2:elem1/ns2:codigoCt1</to>
    </copy>
    </assign>
    <else>
    <assign name="Assign2">
    <copy>
    <from>$inputVariable.parameters/ns2:codigo</from>
    <to>$outputVariable.parameters/ns2:elem2/ns2:codigoCt2</to>
    </copy>
    </assign>
    </else>
    </if>
    <reply name="replyOutput" partnerLink="bpelprocess1_client" portType="ns1:ResultadoLegadoENT" operation="BuscarLaudoPorFichaIdioma" variable="outputVariable"/>
    </sequence>

    Then, when the process runs, the initialization of the outputVariable is:

    <outputVariable>
    <part name="parameters">
    <operationResponse>
    <elem1>
    <codigoCt1/>
    </elem1>
    <elem2>
    <codigoCt2/>
    </elem2>
    </operationResponse>
    </part>
    </outputVariable>

    And the response is:

    <outputVariable>
    <part name="parameters">
    <operationResponse>
    <elem1>
    <codigoCt1>1</codigoCt1>
    </elem1>
    <elem2>
    <codigoCt2/>
    </elem2>
    </operationResponse>
    </part>
    </outputVariable>


    So, why the response of the secound example has the 'elem2'? Why do I have to force the remove of it?
  • 5. Re: Wrong initialization of outputVariable
    veejai24 Pro
    Currently Being Moderated
    Looks like you some problem with your condition.

    Define your condition like below, you condition should check for string values.

    <condition>$inputVariable.parameters/ns2:codigo=1</condition>

    change as below

    <condition>$inputVariable.parameters/ns2:codigo="1"</condition>

    Give points - it is good etiquette to reward an answerer points (5 - helpful; 10 - correct) for their post if they answer your question.

    Thanks,
    Vijay
  • 6. Re: Wrong initialization of outputVariable
    samaan_filho1 Newbie
    Currently Being Moderated
    The request is a long, but that is not the problem. the origin is that if there is a possibility of assign in one element of the response, BPEL initiates the outputVariable with them, even if the 'if' condition result in 'true' or 'false'.
  • 7. Re: Wrong initialization of outputVariable
    DeepakDabbiru Explorer
    Currently Being Moderated
    Hi,

    I have tried the scenario you explained with a simple xsd with "Choice" as below:

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

    <element name="processResponse">
    <complexType>
    <choice>
    <element name="result1" type="string"/>
    <element name="result2" type="string"/>
    </choice>
    </complexType>
    </element>

    And then I have used the Transformation activity rather than the Assign activity in the IF Else condition. And I am able to get the desired results.

    <outputVariable>
    <part name="payload">
    <processResponse>
    <client:result1>One</client:result1>
    </processResponse>
    </part>
    </outputVariable>

    Hope that helps.

    Cheers,
    Deepak
  • 8. Re: Wrong initialization of outputVariable
    samaan_filho1 Newbie
    Currently Being Moderated
    Indeed, that scenario with Transform and choice works, but thats not the problem. I can´t change the response to choice, and I can´t change the assign to Transform. I have to work with the scenario that I had posted...

    I wanted to understand why BPEL initiate the outputVariable with empty elements if those elements are on assigns at the process.

    To explain better my scenario, the outputVariable has a boolean and a exception element (in the 'catch all', the process returns the outputVariable with the exception element, it doesn't throw a soap fault). So, if any exception occurs, the boolean element returns empty... that is the problem. I have to remove the boolean element on 'catch all'. Thats the only way?
  • 9. Re: Wrong initialization of outputVariable
    veejai24 Pro
    Currently Being Moderated
    <if name="If1">
    <documentation/>
    <condition>$inputVariable.payload/client:longVal=5</condition>
    <assign name="Assign1">
    <copy>
    <from>$inputVariable.payload/client:longVal</from>
    <to>$IfVariable</to>
    </copy>
    </assign>
    <else>
    <assign name="Assign2">
    <copy>
    <from>$inputVariable.payload/client:longVal</from>
    <to>$elseVariable</to>
    </copy>
    </assign>
    </else>
    </if>

    The above is working fine with long variable, paste your entire .bpel file here.

    Thanks,
    Vijay
  • 10. Re: Wrong initialization of outputVariable
    samaan_filho1 Newbie
    Currently Being Moderated
    The problem I'm facing is not with the 'if' statement. The problem is that the outputVariable has ALL the elements of the schema, just because the element is in a assign. Appears that, when the process starts, BPEL look which elements has the possibility to reply and initiates them in the outputVariable.

    If the process doesn't have any assign, the outputVariable initiates:

    <outputVariable>
    <part name="parameters">
    <operationResponse/>
    </part>
    </outputVariable>

    If has a assign anywhere (even in a place that will not pass), the outputVariable initiates:

    <outputVariable>
    <part name="parameters">
    <operationResponse>
    <elem1>
    <codigoCt1/>
    </elem1>
    <elem2>
    <codigoCt2/>
    </elem2>
    </operationResponse>
    </part>
    </outputVariable>

    My question:

    Why the process initiates the variable with empty elements when those elements are in assigns?
  • 11. Re: Wrong initialization of outputVariable
    mathieu.d Explorer
    Currently Being Moderated
    Hi,

    Unfortunatly, that is the behaviour of the assign activity (at least as far as I know and have experienced).
    It surprised me at first also, but when you know it you should deal with it accordingly (or raise an SR to get Oracle point of view).

    I see three way to workaround this :
    - Initialize / overwrite yourself the variable using a literal XML (without these two fields)
    - Use the "remove" feature of the assign (the one you use)
    - Use the "transform" activity instead of the "assign" (and be sure to select "do not generate unmapped nodes")

    regards,
    mathieu
  • 12. Re: Wrong initialization of outputVariable
    samaan_filho1 Newbie
    Currently Being Moderated
    Mathieu, thanks for your answer. That's that I was doing when I posted the question... Unfortunately that's the way out of the problem.

    I´ll try to send this question to ORACLE, to see if this problem is even mapped.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points