Topic
  • 2 replies
  • Latest Post - ‏2013-03-07T12:16:32Z by nsousa
cesce
cesce
1 Post

Pinned topic Limit request methods

‏2010-06-30T17:10:02Z |
Hi,

I have a webservice that, till now, can invoke several methods in the request. For example, getName, getAddress, etc. But know I wan't to just authorize one method to be requested by that service.

For example:

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

<soapenv:Header/>
<soapenv:Body>
<getName>
<xnumber>123</xnumber>
<getName>
</soapenv:Body>
</soapenv:Envelope>


Where I have <getName>, a can have getAddress or other method. Which is the best way to set the Datapower to just authorize getName method to be in the request message.

I've tried use filter action in my policy, but i'm not having much luck.

Can anyone give me some guidance?

Thanks.

Nuno
Updated on 2013-03-07T12:16:32Z at 2013-03-07T12:16:32Z by nsousa
  • HermannSW
    HermannSW
    7072 Posts

    Re: Limit request methods

    ‏2010-06-30T22:38:11Z  
    Write a stylesheet which you will use in a filter action.

    Use <dp:accept/> and <dp:reject>reason text</dp:reject>, see the example under "accept" in Extension Functions catalog.

    It could look like:
    ...
      <xsl:choose> ...
        <xsl:when test="/*/*/getName"> 
          <dp:accept/>
        </xsl:when>
        ... other accepts ...
        <xsl:otherwise>
          <dp:reject>not an allowed request method</dp:reject>
        </xsl:otherwise>
      </xsl:choose>
    ...
    
    Updated on 2014-03-25T03:42:48Z at 2014-03-25T03:42:48Z by iron-man
  • nsousa
    nsousa
    22 Posts

    Re: Limit request methods

    ‏2013-03-07T12:16:32Z  
    • HermannSW
    • ‏2010-06-30T22:38:11Z
    Write a stylesheet which you will use in a filter action.

    Use <dp:accept/> and <dp:reject>reason text</dp:reject>, see the example under "accept" in Extension Functions catalog.

    It could look like:
    <pre class="java dw" data-editor-lang="java" data-pbcklang="java" dir="ltr">... <xsl:choose> ... <xsl:when test="/*/*/getName"> <dp:accept/> </xsl:when> ... other accepts ... <xsl:otherwise> <dp:reject>not an allowed request method</dp:reject> </xsl:otherwise> </xsl:choose> ... </pre>
    Hi Hermann,

    Thanks for the help, it works just fine!

    I just have to set test="/*/*/*", because it just don't do the match because of the namespace used.

    Once again, thanks a lot!

    Regards,

    Nuno