Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
16 replies Latest Post - ‏2014-10-29T17:08:01Z by kenhygh
dpdeveloper
dpdeveloper
111 Posts
ACCEPTED ANSWER

Pinned topic Results Action Multiple destinations

‏2013-03-14T22:49:15Z |
Hi,

We have test case, a single input should go to multiple destinations. As a part of this, I am using Results action with context variable set as below.

<xsl:variable name="MultiResults">
<results mode="require-all" multiple-outputs="true">
<url>http://0.0.0.0:10038/test</url>
<url>http://0.0.0.0:10038/test</url>
<url>http://0.0.0.0:10038/test</url>
</results>
</xsl:variable>
<dp:set-variable name="'var://context/uservars/resultURLs'" value="$MultiResults"/>

The requests are going fine and I can see all of them coming at the destination with correct input and the backend is responding with correct responses.

The issue I am having is to capture the responses. The document says as below

<output>
<xsl:copy-of select="dp:variable('var://context/OUTPUT_1')" />
<xsl:copy-of select="dp:variable('var://context/OUTPUT_2')" />
<xsl:copy-of select="dp:variable('var://context/OUTPUT_3')" />
</output>

Considering OUTPUT being the output context name of the results action.

However, I am not able to see any of the responses in these context variables. I am only able to see the 200 success code and some other http headers which was sent by backend..

If I set the output of the results action as var://context/OUTPUT, I am able to see only the third and final response (output of this result action is input to another result action) as input to the next result action.

How can we capture the responses? do we have set any seperate context variables?

Thanks....
Updated on 2013-03-22T04:18:38Z at 2013-03-22T04:18:38Z by dpdeveloper
  • HermannSW
    HermannSW
    4491 Posts
    ACCEPTED ANSWER

    Re: Results Action Multiple destinations

    ‏2013-03-15T09:10:41Z  in response to dpdeveloper
    There are 4 predefined contexts in DataPower with special meaning.
    • INPUT
    • PIPE
    • NULL
    • OUTPUT

    Please try any other results action output context name but OUTPUT.

    And in case you mark your results action as asynchronous (parallel processing, less latency),
    you will have to add an Event sink action before you can collect the results.

     
    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>
    • dpdeveloper
      dpdeveloper
      111 Posts
      ACCEPTED ANSWER

      Re: Results Action Multiple destinations

      ‏2013-03-15T15:40:07Z  in response to HermannSW
      Thanks Hermann.

      So I changed it to async action and kept a event sync with 3 minutes timeout and I see all three parallel calls going to backend and backend is responding with proper data.

      I changed the output of results action as "asyncoutput" and after the eventsync action, I still don't see the response of each calls in any of the context variables, only 200 code and some http response h eaders..

      All I see is context variables with _extension as var://context/asyncoutput_1/_extension/response-header/Content-Type.. Like this for all three calls...

      Any suggestions on where I might be going wrong?

      Thanks...
      • GKReddy
        GKReddy
        134 Posts
        ACCEPTED ANSWER

        Re: Results Action Multiple destinations

        ‏2013-03-15T20:04:56Z  in response to dpdeveloper
        Never tried, but this link might be helpful.

        http://www.ibm.com/developerworks/webservices/library/ws-datapower/index.html

        • GK
  • HermannSW
    HermannSW
    4491 Posts
    ACCEPTED ANSWER

    Re: Results Action Multiple destinations

    ‏2013-03-15T22:16:17Z  in response to dpdeveloper
    Hi dpdeveloper,

    please attach a service export, that will allow to inspect what is wrong.

     
    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>
    • dpdeveloper
      dpdeveloper
      111 Posts
      ACCEPTED ANSWER

      Re: Results Action Multiple destinations

      ‏2013-03-18T02:21:55Z  in response to HermannSW
      Hi Hermann

      I have attached mpgw export.

      Thanks for the help....
      • HermannSW
        HermannSW
        4491 Posts
        ACCEPTED ANSWER

        Re: Results Action Multiple destinations

        ‏2013-03-18T10:06:39Z  in response to dpdeveloper
        Hi,

        find attached the working config, I did
        • add a HTTP service on port 12505 serving three files "Response.[1-3].xml"
        • replace "0.0.0.0" by "127.0.0.1" in the URLs
        • make the URLs distinct to request the sample response files
        • remove the Server2Client rule (not needed because of skip-backside)

        See that it works here:
        $ curl --data-binary "<foobar/>" http://dp2-l3:12501 -s | tidy -qi -xml
        <?xml version="1.0" encoding="utf-8"?>
        <output>
          <response>1</response>
          <response>2</response>
          <response>3</response>
        </output>
         
        $
        


         
        Hermann <myXsltBlog/> <myXsltTweets/> <myCE/>
        Updated on 2014-03-25T02:37:45Z at 2014-03-25T02:37:45Z by iron-man
        • dpdeveloper
          dpdeveloper
          111 Posts
          ACCEPTED ANSWER

          Re: Results Action Multiple destinations

          ‏2013-03-20T21:23:39Z  in response to HermannSW
          Thanks Hermann for taking time..

          It worked after using your configuration..

          One more question, after the event sink, still I am not seeing the responses in context variables tab.

          <xsl:copy-of select="dp:variable('var://context/asyncoutput_1')"/>
          <xsl:copy-of select="dp:variable('var://context/asyncoutput_2')"/>
          <xsl:copy-of select="dp:variable('var://context/asyncoutput_3')"/>

          But however, within the stylesheets, these contexts are coming..

          Any reason for not able to see these in context variable tab via probe?

          Thanks....
          • HermannSW
            HermannSW
            4491 Posts
            ACCEPTED ANSWER

            Re: Results Action Multiple destinations

            ‏2013-03-21T00:34:51Z  in response to dpdeveloper
            > One more question, after the event sink, still I am not seeing the responses in context variables tab.
            >
            The context variables tab displays the context variables, not the contexts.

            Displaying a generated context in Probe is a bit tricky.
            For your config I just inserted
            asyncoutput_3 -- RESULTS -- NULL

            after the event sink action.
            As you can see this gives you asyncoutput_3 context in Probe:


             
            Allowing for a better display of multiple generated contexts would be a nice ER you may want to enter here:
            http://www.ibm.com/developerworks/rfe/

            (I would be the one who would implement that, if the ER would get approved ;-) )

             
            Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>
            • HermannSW
              HermannSW
              4491 Posts
              ACCEPTED ANSWER

              Re: Results Action Multiple destinations

              ‏2013-03-21T00:48:55Z  in response to HermannSW
              I forgot to mention that you can access all contexts via the 'var://service/multistep/contexts' service variable.

              In your case:
              <contextList>
                  <contextName>asyncoutput</contextName>
                  <contextName>asyncoutput_1</contextName>
                  <contextName>asyncoutput_3</contextName>
                  <contextName>uservars</contextName>
                  <contextName>asyncoutput_2</contextName>
                  <contextName>INPUT</contextName>
              </contextList>
              


               
              Hermann <myXsltBlog/> <myXsltTweets/> <myCE/>
              Updated on 2014-03-25T02:37:37Z at 2014-03-25T02:37:37Z by iron-man
              • dpdeveloper
                dpdeveloper
                111 Posts
                ACCEPTED ANSWER

                Re: Results Action Multiple destinations

                ‏2013-03-22T04:18:38Z  in response to HermannSW
                Thanks again Hermann for looking into this....
  • Daviiid
    Daviiid
    282 Posts
    ACCEPTED ANSWER

    Re: Results Action Multiple destinations

    ‏2014-10-29T13:43:33Z  in response to dpdeveloper

    A question about this topic

    how send differents xml to differents backends

    I have a single xml input. I have to create an undefined number of xml for differents backEnd

    Is it possible ?

    • kenhygh
      kenhygh
      1461 Posts
      ACCEPTED ANSWER

      Re: Results Action Multiple destinations

      ‏2014-10-29T13:56:25Z  in response to Daviiid

      What do you mean 'undefined'? you have no way of knowing at design time? defined by the data?

      • Daviiid
        Daviiid
        282 Posts
        ACCEPTED ANSWER

        Re: Results Action Multiple destinations

        ‏2014-10-29T14:05:37Z  in response to kenhygh

        Hi Ken :-)

        I have a database with 2 colums : urlBackEnd, XmlBlobFormat

        The idea is the MPG  send as many message as there are lines in database

        Updated on 2014-10-29T14:07:05Z at 2014-10-29T14:07:05Z by Daviiid
        • kenhygh
          kenhygh
          1461 Posts
          ACCEPTED ANSWER

          Re: Results Action Multiple destinations

          ‏2014-10-29T14:10:49Z  in response to Daviiid

          <xsl:for-each ....>
            <dp:url-open .....>

          • Daviiid
            Daviiid
            282 Posts
            ACCEPTED ANSWER

            Re: Results Action Multiple destinations

            ‏2014-10-29T14:23:43Z  in response to kenhygh

            yes

            but, i forgot to said that i need to sign each message with a Sign Action already configured with a existing Document Crypto Map .

            I know how to configure this Sign Action with the drag and drop option on the policy (if there is only one message), but not in xslt for each message before the dp:url-open you proposed

             

            • kenhygh
              kenhygh
              1461 Posts
              ACCEPTED ANSWER

              Re: Results Action Multiple destinations

              ‏2014-10-29T17:08:01Z  in response to Daviiid

              check out the for-each action then.

              You'll also need to figure out what you're going to return to the caller.