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.
15 replies Latest Post - ‏2012-11-05T15:50:18Z by PullMeOut
NILAY97
NILAY97
210 Posts
ACCEPTED ANSWER

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
    1346 Posts
    ACCEPTED ANSWER

    Re: how to edit url coming in request.

    ‏2012-10-15T02:02:17Z  in response to NILAY97
    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
      210 Posts
      ACCEPTED ANSWER

      Re: how to edit url coming in request.

      ‏2012-10-31T09:53:47Z  in response to swlinn
      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
      • swlinn
        swlinn
        1346 Posts
        ACCEPTED ANSWER

        Re: how to edit url coming in request.

        ‏2012-10-31T15:38:11Z  in response to NILAY97
        <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
          210 Posts
          ACCEPTED ANSWER

          Re: how to edit url coming in request.

          ‏2012-10-31T15:45:32Z  in response to swlinn
          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
          • Daviiid
            Daviiid
            282 Posts
            ACCEPTED ANSWER

            Re: how to edit url coming in request.

            ‏2012-10-31T17:38:29Z  in response to NILAY97
            Hello

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

              Re: how to edit url coming in request.

              ‏2012-11-01T07:29:29Z  in response to Daviiid
              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
          • swlinn
            swlinn
            1346 Posts
            ACCEPTED ANSWER

            Re: how to edit url coming in request.

            ‏2012-10-31T18:37:05Z  in response to NILAY97
            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
              210 Posts
              ACCEPTED ANSWER

              Re: how to edit url coming in request.

              ‏2012-11-01T07:27:28Z  in response to swlinn
              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
              • swlinn
                swlinn
                1346 Posts
                ACCEPTED ANSWER

                Re: how to edit url coming in request.

                ‏2012-11-01T12:57:41Z  in response to NILAY97
                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
        • NILAY97
          NILAY97
          210 Posts
          ACCEPTED ANSWER

          Re: how to edit url coming in request.

          ‏2012-10-31T16:13:09Z  in response to swlinn
          Please Help me...
          • kenhygh
            kenhygh
            1475 Posts
            ACCEPTED ANSWER

            Re: how to edit url coming in request.

            ‏2012-10-31T17:08:21Z  in response to NILAY97
            What other messages are you seeing in the log? Are you seeing your own messages output?
            • NILAY97
              NILAY97
              210 Posts
              ACCEPTED ANSWER

              Re: how to edit url coming in request.

              ‏2012-11-01T07:32:13Z  in response to kenhygh
              @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
                1475 Posts
                ACCEPTED ANSWER

                Re: how to edit url coming in request.

                ‏2012-11-01T11:25:33Z  in response to NILAY97
                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
    • NILAY97
      NILAY97
      210 Posts
      ACCEPTED ANSWER

      Re: how to edit url coming in request.

      ‏2012-10-31T15:25:02Z  in response to swlinn
      Please Help me..its very urgent
      • PullMeOut
        PullMeOut
        47 Posts
        ACCEPTED ANSWER

        Re: how to edit url coming in request.

        ‏2012-11-05T15:50:18Z  in response to NILAY97
        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.