Topic
  • 15 replies
  • Latest Post - ‏2012-11-05T15:50:18Z by PullMeOut
NILAY97
NILAY97
224 Posts

Pinned topic how to edit url coming in request.

‏2012-10-14T04:12:02Z |
I need to edit the url that will come in request and send it to back-end...

Say, in request the consumer sends me-- http://www.google.com.
What i need to do here is to edit the url and send it to backend to get some list of reports...

like....http://www.google.com/getReportlist.do

this is what i need to implement. Can i handle this in my xsl.....

Please Help....
Updated on 2012-11-05T15:50:18Z at 2012-11-05T15:50:18Z by PullMeOut
  • swlinn
    swlinn
    1348 Posts

    Re: how to edit url coming in request.

    ‏2012-10-15T02:02:17Z  
    Specify your service as having a dynamic backend, and have an xsl do

    <dp:set-variable name="'var://service/routing-url'" value="concat($backend, '/getReportlist.do')" />

    where $backend has the value of http://backendhost:port

    Regards,
    Steve
  • NILAY97
    NILAY97
    224 Posts

    Re: how to edit url coming in request.

    ‏2012-10-31T09:53:47Z  
    • swlinn
    • ‏2012-10-15T02:02:17Z
    Specify your service as having a dynamic backend, and have an xsl do

    <dp:set-variable name="'var://service/routing-url'" value="concat($backend, '/getReportlist.do')" />

    where $backend has the value of http://backendhost:port

    Regards,
    Steve
    Thnx Steve for the reply...

    I have done exactly as u told me...this is my xsl

    <xsl:stylesheet
    xmlns:dp="http://www.datapower.com/extensions"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    extension-element-prefixes="dp"
    exclude-result-prefixes="dp"
    version="1.0">

    <xsl:template match="/">
    <xsl:variable name="URI" select="dp:variable('var://service/URI')" />

    <xsl:message dp:priority="error">
    Value of URI is
    <xsl:value-of select="$URI"></xsl:value-of>

    </xsl:message>

    <xsl:variable name="URL" select= "'http://10.254.222.77:23866'"/>

    <xsl:message dp:priority="error">
    Value of URL is
    <xsl:value-of select="$URL"></xsl:value-of>

    </xsl:message>
    <dp:set-variable name="'var://service/routing-url'" value="concat('$URL','$URI')" />

    </xsl:template>
    </xsl:stylesheet>

    Ideally it shoud goto http://10.254.222.77:23866 but it is not going there. I have selected Dynamic backend and kept the output of this xsl as "NULL" in data power.

    Please Help me on this
  • NILAY97
    NILAY97
    224 Posts

    Re: how to edit url coming in request.

    ‏2012-10-31T15:25:02Z  
    • swlinn
    • ‏2012-10-15T02:02:17Z
    Specify your service as having a dynamic backend, and have an xsl do

    <dp:set-variable name="'var://service/routing-url'" value="concat($backend, '/getReportlist.do')" />

    where $backend has the value of http://backendhost:port

    Regards,
    Steve
    Please Help me..its very urgent
  • swlinn
    swlinn
    1348 Posts

    Re: how to edit url coming in request.

    ‏2012-10-31T15:38:11Z  
    • NILAY97
    • ‏2012-10-31T09:53:47Z
    Thnx Steve for the reply...

    I have done exactly as u told me...this is my xsl

    <xsl:stylesheet
    xmlns:dp="http://www.datapower.com/extensions"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    extension-element-prefixes="dp"
    exclude-result-prefixes="dp"
    version="1.0">

    <xsl:template match="/">
    <xsl:variable name="URI" select="dp:variable('var://service/URI')" />

    <xsl:message dp:priority="error">
    Value of URI is
    <xsl:value-of select="$URI"></xsl:value-of>

    </xsl:message>

    <xsl:variable name="URL" select= "'http://10.254.222.77:23866'"/>

    <xsl:message dp:priority="error">
    Value of URL is
    <xsl:value-of select="$URL"></xsl:value-of>

    </xsl:message>
    <dp:set-variable name="'var://service/routing-url'" value="concat('$URL','$URI')" />

    </xsl:template>
    </xsl:stylesheet>

    Ideally it shoud goto http://10.254.222.77:23866 but it is not going there. I have selected Dynamic backend and kept the output of this xsl as "NULL" in data power.

    Please Help me on this
    <dp:set-variable name="'var://service/routing-url'" value="concat('$URL','$URI')" />

    This is concatenating two strings, not two variables. change to ...

    <dp:set-variable name="'var://service/routing-url'" value="concat($URL,$URI)" />

    Regards,
    Steve
  • NILAY97
    NILAY97
    224 Posts

    Re: how to edit url coming in request.

    ‏2012-10-31T15:45:32Z  
    • swlinn
    • ‏2012-10-31T15:38:11Z
    <dp:set-variable name="'var://service/routing-url'" value="concat('$URL','$URI')" />

    This is concatenating two strings, not two variables. change to ...

    <dp:set-variable name="'var://service/routing-url'" value="concat($URL,$URI)" />

    Regards,
    Steve
    Thnx for the help Steve..but i had done this earlier...but still it is not getting routed..

    In the logs, i can see " Context was not available".

    It should show in the probe under Outbound URL- http://10.254.222.77:23866

    but its showing the IP and Port of MPGW.

    Please Help me on this. pls

    Regards,
    Nilay
  • NILAY97
    NILAY97
    224 Posts

    Re: how to edit url coming in request.

    ‏2012-10-31T16:13:09Z  
    • swlinn
    • ‏2012-10-31T15:38:11Z
    <dp:set-variable name="'var://service/routing-url'" value="concat('$URL','$URI')" />

    This is concatenating two strings, not two variables. change to ...

    <dp:set-variable name="'var://service/routing-url'" value="concat($URL,$URI)" />

    Regards,
    Steve
    Please Help me...
  • kenhygh
    kenhygh
    1576 Posts

    Re: how to edit url coming in request.

    ‏2012-10-31T17:08:21Z  
    • NILAY97
    • ‏2012-10-31T16:13:09Z
    Please Help me...
    What other messages are you seeing in the log? Are you seeing your own messages output?
  • Daviiid
    Daviiid
    288 Posts

    Re: how to edit url coming in request.

    ‏2012-10-31T17:38:29Z  
    • NILAY97
    • ‏2012-10-31T15:45:32Z
    Thnx for the help Steve..but i had done this earlier...but still it is not getting routed..

    In the logs, i can see " Context was not available".

    It should show in the probe under Outbound URL- http://10.254.222.77:23866

    but its showing the IP and Port of MPGW.

    Please Help me on this. pls

    Regards,
    Nilay
    Hello

    --It should show in the probe under Outbound URL- http://10.254.222.77:23866
    Your client sent a call on which adress?
  • swlinn
    swlinn
    1348 Posts

    Re: how to edit url coming in request.

    ‏2012-10-31T18:37:05Z  
    • NILAY97
    • ‏2012-10-31T15:45:32Z
    Thnx for the help Steve..but i had done this earlier...but still it is not getting routed..

    In the logs, i can see " Context was not available".

    It should show in the probe under Outbound URL- http://10.254.222.77:23866

    but its showing the IP and Port of MPGW.

    Please Help me on this. pls

    Regards,
    Nilay
    Context not available indicates you have a processing action referencing a context that doesn't exist. If you look in the probe, it should show the failure (yellow context after the failing action). Examine that failing action and make sure the input context is legitimate.

    Regards,
    Steve
  • NILAY97
    NILAY97
    224 Posts

    Re: how to edit url coming in request.

    ‏2012-11-01T07:27:28Z  
    • swlinn
    • ‏2012-10-31T18:37:05Z
    Context not available indicates you have a processing action referencing a context that doesn't exist. If you look in the probe, it should show the failure (yellow context after the failing action). Examine that failing action and make sure the input context is legitimate.

    Regards,
    Steve
    I'am using the above mentioned sytlesheet under Transform action and Under Advanced- Method Rewrite action to rewrite the method to "POST" and finally the result action.

    I'am sending my request from MPGW(port- 238869) and then it should goto My Firewall(23866).

    But its not going. I don knw which context it is talking about in the Logs. I'am not getting as exactly what i'am referencing that is not there.

    Thanks,
    Nilay
  • NILAY97
    NILAY97
    224 Posts

    Re: how to edit url coming in request.

    ‏2012-11-01T07:29:29Z  
    • Daviiid
    • ‏2012-10-31T17:38:29Z
    Hello

    --It should show in the probe under Outbound URL- http://10.254.222.77:23866
    Your client sent a call on which adress?
    My Client sent the request on http://10.254.222.77:23869(which is my MPGW) from where it is going to my FW(23866).

    But i don knw the reason behind this not getting routed.

    Thanks,
    Nilay
  • NILAY97
    NILAY97
    224 Posts

    Re: how to edit url coming in request.

    ‏2012-11-01T07:32:13Z  
    • kenhygh
    • ‏2012-10-31T17:08:21Z
    What other messages are you seeing in the log? Are you seeing your own messages output?
    @ken- No i'am not seeing my own messages in the O/P.

    In soapUI it shows me, INTERNAL ERROR(from client).

    Please help.

    Thanks,
    Nilay
  • kenhygh
    kenhygh
    1576 Posts

    Re: how to edit url coming in request.

    ‏2012-11-01T11:25:33Z  
    • NILAY97
    • ‏2012-11-01T07:32:13Z
    @ken- No i'am not seeing my own messages in the O/P.

    In soapUI it shows me, INTERNAL ERROR(from client).

    Please help.

    Thanks,
    Nilay
    If you aren't seeing messages from your stylesheet, it means your stylesheet is not being executed.

    From the 'no context' message, I'm guessing that the input context to your transform action is not valid.

    Ken
  • swlinn
    swlinn
    1348 Posts

    Re: how to edit url coming in request.

    ‏2012-11-01T12:57:41Z  
    • NILAY97
    • ‏2012-11-01T07:27:28Z
    I'am using the above mentioned sytlesheet under Transform action and Under Advanced- Method Rewrite action to rewrite the method to "POST" and finally the result action.

    I'am sending my request from MPGW(port- 238869) and then it should goto My Firewall(23866).

    But its not going. I don knw which context it is talking about in the Logs. I'am not getting as exactly what i'am referencing that is not there.

    Thanks,
    Nilay
    If you look at your probe, what action is the last action executed and failed (you'll see the yellow spy glass following the action in the probe). Examine that action's input context and make sure that a previous action has created it. Remember the context names are case sensitive.

    Regards,
    Steve
  • PullMeOut
    PullMeOut
    47 Posts

    Re: how to edit url coming in request.

    ‏2012-11-05T15:50:18Z  
    • NILAY97
    • ‏2012-10-31T15:25:02Z
    Please Help me..its very urgent
    your show probe view log sometimes will not show errors in detail , try setting up logging level to debug in trouble shooting panel and see the view logs under the control panel tab , you will see each step of your execution , from the logs you can make it out what your XSLT does.