Topic
  • 16 replies
  • Latest Post - ‏2014-10-29T17:08:01Z by kenhygh
dpdeveloper
dpdeveloper
111 Posts

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
    4741 Posts

    Re: Results Action Multiple destinations

    ‏2013-03-15T09:10:41Z  
    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

    Re: Results Action Multiple destinations

    ‏2013-03-15T15:40:07Z  
    • HermannSW
    • ‏2013-03-15T09:10:41Z
    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/>
    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
    138 Posts

    Re: Results Action Multiple destinations

    ‏2013-03-15T20:04:56Z  
    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...
    Never tried, but this link might be helpful.

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

    • GK
  • HermannSW
    HermannSW
    4741 Posts

    Re: Results Action Multiple destinations

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

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

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

    Re: Results Action Multiple destinations

    ‏2013-03-18T02:21:55Z  
    • HermannSW
    • ‏2013-03-15T22:16:17Z
    Hi dpdeveloper,

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

     
    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>
    Hi Hermann

    I have attached mpgw export.

    Thanks for the help....
  • HermannSW
    HermannSW
    4741 Posts

    Re: Results Action Multiple destinations

    ‏2013-03-18T10:06:39Z  
    Hi Hermann

    I have attached mpgw export.

    Thanks for the help....
    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

    Re: Results Action Multiple destinations

    ‏2013-03-20T21:23:39Z  
    • HermannSW
    • ‏2013-03-18T10:06:39Z
    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:
    <pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr">$ 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> $ </pre>

     
    Hermann <myXsltBlog/> <myXsltTweets/> <myCE/>
    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
    4741 Posts

    Re: Results Action Multiple destinations

    ‏2013-03-21T00:34:51Z  
    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....
    > 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
    4741 Posts

    Re: Results Action Multiple destinations

    ‏2013-03-21T00:48:55Z  
    • HermannSW
    • ‏2013-03-21T00:34:51Z
    > 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/>
    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

    Re: Results Action Multiple destinations

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

    In your case:
    <pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr"><contextList> <contextName>asyncoutput</contextName> <contextName>asyncoutput_1</contextName> <contextName>asyncoutput_3</contextName> <contextName>uservars</contextName> <contextName>asyncoutput_2</contextName> <contextName>INPUT</contextName> </contextList> </pre>

     
    Hermann <myXsltBlog/> <myXsltTweets/> <myCE/>
    Thanks again Hermann for looking into this....
  • Daviiid
    Daviiid
    289 Posts

    Re: Results Action Multiple destinations

    ‏2014-10-29T13:43:33Z  

    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
    1577 Posts

    Re: Results Action Multiple destinations

    ‏2014-10-29T13:56:25Z  
    • Daviiid
    • ‏2014-10-29T13:43:33Z

    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 ?

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

  • Daviiid
    Daviiid
    289 Posts

    Re: Results Action Multiple destinations

    ‏2014-10-29T14:05:37Z  
    • kenhygh
    • ‏2014-10-29T13:56:25Z

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

    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
    1577 Posts

    Re: Results Action Multiple destinations

    ‏2014-10-29T14:10:49Z  
    • Daviiid
    • ‏2014-10-29T14:05:37Z

    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

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

  • Daviiid
    Daviiid
    289 Posts

    Re: Results Action Multiple destinations

    ‏2014-10-29T14:23:43Z  
    • kenhygh
    • ‏2014-10-29T14:10:49Z

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

    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
    1577 Posts

    Re: Results Action Multiple destinations

    ‏2014-10-29T17:08:01Z  
    • Daviiid
    • ‏2014-10-29T14:23:43Z

    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

     

    check out the for-each action then.

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