Search code examples
web-servicesbpel

how do i get the return value from a bpel boolean variable?


I am new to BPEL. I am invoking a web service to fill a BPEL variable:

<bpel:variable name="hasASkillOutput" messageType="ns2:personHasSkillResponse"></bpel:variable>
....
<bpel:invoke name="call_personHasASkill"  partnerLink="SkillPossessionService"  operation="personHasSkill"  portType="ns2:SkillPossessionServicePortType"
                inputVariable="hasASkillInput" outputVariable="hasASkillOutput"></bpel:invoke>

The service that I invoke returns a boolean. How can I access that value as part of a condition expression?

        <bpel:if name="DoesPersonHaveTheSkill">
                <bpel:condition><hasASkillOutput is true></bpel:condition>
        </bpel:if>

Solution

  • The structure of the messageType personHasSkillResponse is defined in the WSDL that is linked by your partnerLink SkillPossessionService. You you have to look up that structure there and then you can use an ordinary XPath 1.0 expression in your condition and reference the variable hasASkillOutput.

    If for example your message type definition looks like this:

    <message name="personHasSkillResponse">
        <part name="skillResponse" element="xsd:boolean"/>
    </message>
    

    Your condition would have to look like this:

        <bpel:if name="DoesPersonHaveTheSkill">
                <bpel:condition>$hasASkillOutput.skillResponse</bpel:condition>
        </bpel:if>