2 Replies Latest reply: Apr 4, 2014 9:45 AM by Philipp Grigoryev RSS

    BPEL check node is not null

    Philipp Grigoryev

      Hey gurus,

       

      Could you please advise the way to check if a specific node is present in a payload?

       

      I have a structure like this as my input, where updatedAttribute can contain multiple attribute pairs <name><value>. I wonder how I can check if I have a specific one in my payload. Right now I copy from /ns2:update/updatedAttribute[name='Email']/value and try to catch an exception 'SelectionFailure' if there is no attribute in a payload. But I think there should be a more elegant way of achieving the same result. Can I somehow involve 'If' construction?

       

      <UpdateOp_InputVariable>

      <part  name="parameters">
      <ns2:update>
      <objectClass>__ACCOUNT__</objectClass>

       

      <uid>cnt:90A0C8EA5AE73B44844B6E566704F583</uid>

      <updatedAttribute>

      <name>Email</name>

       

      <value>jmullins@domain.com</value>

      </updatedAttribute>

      </ns2:update>

      </part>

      </UpdateOp_InputVariable>


      Thank you,

      Philipp

        • 1. Re: BPEL check node is not null
          Eric Elzinga

          Im not sure if you want to check on several other attributes..if so i would recommend to do this in xsl

           

          in bpel you could use a switch with condition  /ns2:update/updatedAttribute[name='Email']

          in xsl youu could use something like when test=" ...

          (see : XSLT &amp;lt;xsl:when&amp;gt; Element)

          • 2. Re: BPEL check node is not null
            Philipp Grigoryev

            Hi Eric,

             

            thank you for the prompt reply. But what if /ns2:update/updatedAttribute node doesn't contain <name>Email</name>? It's exactly the case when I get my Selection Failure exception. I wanted to check if it's actually present in a payload. "Email" is just an example, I need to check about 7-8 different attributes and make my invoke call based on what attribute is updated (see payload below)

             

            <UpdateOp_InputVariable>

            <part  name="parameters">

            <ns2:update>
            <objectClass>__ACCOUNT__</objectClass>

             

            <uid>cnt:90A0C8EA5AE73B44844B6E566704F583</uid>

            <updatedAttribute>

            <name>JobCode</name>

             

            <value>1524/value>

            </updatedAttribute>

            <updatedAttribute>

            <name>Organization</name>

             

            <value>Org1</value>

            </updatedAttribute>

             

            </ns2:update>

            </part>

            </UpdateOp_InputVariable>

             

            I thought about XLST but again, what is the test condition for such a situation? I'm novice in BPEL/XSLT, so I tried to search a forum for that question, didn't find anything useful though. In any programming language I would iterate through a list of UpdatedAttributes and check the <name> of each and form an invocation payload accordingly. But don't know if I can do the same here.

             

            Regards,

            Philipp