Topic
  • 3 replies
  • Latest Post - ‏2013-04-20T13:32:47Z by DPUser77
SystemAdmin
SystemAdmin
6772 Posts

Pinned topic using DP:openURL()

‏2012-06-27T09:16:07Z |
I have a scenaio where in request i am getting a value (say A). I have make DP:openURL() and pas A in request. Based on the response, i have to decide#
1. if error comes, return soap:fault.
2. if no error, take value B from response and replace value A with B in incoming request and route the request to some other URL.

I am facing problem in combining these 2 scenaios. Pls. guide.
Updated on 2012-06-27T11:56:41Z at 2012-06-27T11:56:41Z by rukna
  • rukna
    rukna
    32 Posts

    Re: using DP:openURL()

    ‏2012-06-27T11:49:03Z  
    Using the below in an XSLT should help:
    <xsl:variable name="payloadA">
    <templateToCreatePayloadAFromRequest/>
    </xsl:variable>
    <xsl:variable name="urlResponse">
    <dp:url-open response="responsecode-ignore" data-type="xml" target="{$targetUrl}" http-headers="$httpHeaders">
    <xsl:copy-of select="$payLoadA"/>
    </dp:url-open>
    </xsl:variable>
    <xsl:variable name="responseCode" select="$urlResponse/url-open/responsecode"/>
    <!--If its an error the response code would be 0 -->
    <xsl:choose>
    <xsl:when test="$responseCode!='0'>
    <soap:fault/>
    </xsl:when>
    <xsl:otherwise>
    <xsl:variable name="payloadB">
    <templatetoCreatePayloadBUsingUrlResponse/>
    </xsl:variable>
    <dp:url-open response="responsecode-ignore" data-type="xml" target="{$targetUrl}" http-headers="$httpHeaders">
    <xsl:copy-of select="$payLoadB"/>
    </dp:url-open>
    </xsl:otherwise>
    </xsl:choose>
    Try this out and let us know

    Ankur
  • rukna
    rukna
    32 Posts

    Re: using DP:openURL()

    ‏2012-06-27T11:56:41Z  
    • rukna
    • ‏2012-06-27T11:49:03Z
    Using the below in an XSLT should help:
    <xsl:variable name="payloadA">
    <templateToCreatePayloadAFromRequest/>
    </xsl:variable>
    <xsl:variable name="urlResponse">
    <dp:url-open response="responsecode-ignore" data-type="xml" target="{$targetUrl}" http-headers="$httpHeaders">
    <xsl:copy-of select="$payLoadA"/>
    </dp:url-open>
    </xsl:variable>
    <xsl:variable name="responseCode" select="$urlResponse/url-open/responsecode"/>
    <!--If its an error the response code would be 0 -->
    <xsl:choose>
    <xsl:when test="$responseCode!='0'>
    <soap:fault/>
    </xsl:when>
    <xsl:otherwise>
    <xsl:variable name="payloadB">
    <templatetoCreatePayloadBUsingUrlResponse/>
    </xsl:variable>
    <dp:url-open response="responsecode-ignore" data-type="xml" target="{$targetUrl}" http-headers="$httpHeaders">
    <xsl:copy-of select="$payLoadB"/>
    </dp:url-open>
    </xsl:otherwise>
    </xsl:choose>
    Try this out and let us know

    Ankur
    Small correction, the commented line above should have been
    <!--If its an error the response code would not be 0 -->
  • DPUser77
    DPUser77
    70 Posts

    Re: using DP:openURL()

    ‏2013-04-20T13:32:47Z  

    In case of a 200 code repsonse. I need to check the value of a particluar tag in the XML response.

    I am trying to capture the value of that tag  in xml response  with the help of an xpath.

    but i am not able to achieve that.. can you please guide me.

    Updated on 2013-04-20T13:34:06Z at 2013-04-20T13:34:06Z by DPUser77