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.
10 replies Latest Post - ‏2013-02-05T14:30:51Z by Liv2luv
sam4u
sam4u
12 Posts
ACCEPTED ANSWER

Pinned topic Changing style sheet param value using deployment policy

‏2013-01-31T15:42:17Z |
Hi all,

I have developed a MPG service where I am using a transform action which is having a style sheet param.

Next, I created a deployment policy to change the style sheet param value.

But after applying the deployment policy during import of the MPG service, the value of style sheet param is not getting changed.
I found that the param value in advanced tab in transform action was remain same.


Please find below the XSLT where I am using style sheet param.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dp="http://www.datapower.com/extensions" xmlns:dpconfig="http://www.datapower.com/param/config">
<xsl:param name="dpconfig:MyParam" select="'abc'"/>
</xsl:stylesheet>

Please find below the deployment policy.

Configuration match:::
*/*/services/multiprotocol-gateway?Name=MPG_Param&Property=StylesheetParameters/ParameterValue&Value=.*

Modification Type:: Change Configuration

Configuration value:: customValue


Kindly let me know if I have missed something needs to be added to make it successfull.

Thanks in advance for your responses.

Regards,
Sam
Updated on 2013-02-05T14:30:51Z at 2013-02-05T14:30:51Z by Liv2luv
  • Liv2luv
    Liv2luv
    573 Posts
    ACCEPTED ANSWER

    Re: Changing style sheet param value using deployment policy

    ‏2013-01-31T15:59:02Z  in response to sam4u
    The deployment policy should've been:

    <ModifiedConfig>
        <Match>*/*/xml/action?Name=someMPG_xformbin_0&amp;Property=Transform</Match> <Type>change</Type> <Property/> <Value>SOME NEW VALUE</Value> </ModifiedConfig>
    


    someMPG_xformbin_0 should reflect your action name in the corresponding processing rule.
    Updated on 2014-03-25T02:41:14Z at 2014-03-25T02:41:14Z by iron-man
    • sam4u
      sam4u
      12 Posts
      ACCEPTED ANSWER

      Re: Changing style sheet param value using deployment policy

      ‏2013-02-01T15:06:20Z  in response to Liv2luv
      Hi Liv2luv,

      thanks for ur response.
      <ModifiedConfig>
      <Match>*/*/xml/action?Name=someMPG_xformbin_0&Property=Transform</Match>
      <Type>change</Type>
      <Property/>
      <Value>SOME NEW VALUE</Value>
      </ModifiedConfig>

      I guess you are talking about SOMA script through which we can apply the desired changes.
      But I am using deployment policy to change the value.
      • Liv2luv
        Liv2luv
        573 Posts
        ACCEPTED ANSWER

        Re: Changing style sheet param value using deployment policy

        ‏2013-02-01T15:43:16Z  in response to sam4u
        Let's say you have your service defined in Domain A and wanted to deploy to Domain B. Either:

        1. Deploy the deployment policy first followed by the configuration referring the deployment policy
        2. Embed the deployment policy into the configuration during service export and the same will be applied during import

        For #1 above, following is a complete request format:

        
        <env:Envelope xmlns:env=
        "http://schemas.xmlsoap.org/soap/envelope/" xmlns:dp=
        "http://www.datapower.com/schemas/management"> <env:Body> <dp:request domain=
        "Domain-Name"> <dp:modify-config> <ConfigDeploymentPolicy xmlns:env=
        "http://www.w3.org/2003/05/soap-envelope" xmlns:dp=
        "http://www.datapower.com/schemas/management" name=
        "Some-Name"> <mAdminState read-only=
        "true">enabled</mAdminState> <UserSummary>Test Deployment Policy</UserSummary> <ModifiedConfig> <Match>*
        /*/xml/action?Name=someMPG_xformbin_0&Property=Transform</Match> <Type>change</Type> <Property /> <Value>SOME NEW VALUE</Value> </ModifiedConfig> </ConfigDeploymentPolicy> </dp:modify-config> <dp:do-action> <SaveConfig /> </dp:do-action> </dp:request> </env:Body> </env:Envelope>
        


        If you have deployment policy created in the source domain and wanted to carry along with export (as mentioned in #2), please see this thread: http://www.ibm.com/developerworks/forums/thread.jspa?threadID=393467
        • swlinn
          swlinn
          1346 Posts
          ACCEPTED ANSWER

          Re: Changing style sheet param value using deployment policy

          ‏2013-02-02T01:34:26Z  in response to Liv2luv
          To be clear, to change a stylesheet parameter it really depends on which stylesheet parameter you are talking about. Vish's comment above,

          */*/services/multiprotocol-gateway?Name=MPG_Param&Property=StylesheetParameters/ParameterValue&Value=<somePCRE>
          


          is correct if you are talking about the parameter value that is configured on the MPGW service itself. You can also change this on the action, which is looks something like

          */*/xml/action?Name=someMPG_xformbin_0&property=StylesheetParameters/ParameterValue&Value=<somePCRE>
          


          The stylesheet parameter is a complex property of the parent object (either service or action),
          so StylesheetParameters/ParameterValue is the correct property, and you MUST specify a value match
          which is a regular expression, so .* would change all stylesheet param values if you have more than
          one, and .MyParam. could match a specific value to narrow that down to one entry. These values above
          are simply matching statements in a deployment policy, so the change value would be your new value.

          Regards,
          Steve
          Updated on 2014-03-25T02:40:58Z at 2014-03-25T02:40:58Z by iron-man
          • sam4u
            sam4u
            12 Posts
            ACCEPTED ANSWER

            Re: Changing style sheet param value using deployment policy

            ‏2013-02-04T14:56:52Z  in response to swlinn
            Hi,

            After using the below code in deployment policy I am able to get new style sheet param value.

            */*/xml/action?Name=someMPG_xformbin_0&property=StylesheetParameters/ParameterValue&Value=<somePCRE>

            Thanks to all of u guys. :)

            Special thanks to Suresh and Steve for your support. Thanks a lot. :) :)

            Regards,
            Sam
            • PullMeOut
              PullMeOut
              47 Posts
              ACCEPTED ANSWER

              Re: Changing style sheet param value using deployment policy

              ‏2013-02-05T02:06:20Z  in response to sam4u
              I am trying to create a similar deployment policy , i am using web service proxy with a request rule and response rule , I have 2 styles sheet , where the 2 style sheets has same param name with different Param value ,how can I differentiate this in deployment policy ....

              Style sheet 1 :

              <?xml version="1.0" encoding="UTF-8"?>
              <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dp="http://www.datapower.com/extensions" xmlns:dpconfig="http://www.datapower.com/param/config">
              <xsl:param name="dpconfig:MyParam" select="'abc'"/>
              </xsl:stylesheet

              Style sheet 2 :
              <?xml version="1.0" encoding="UTF-8"?>
              <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dp="http://www.datapower.com/extensions" xmlns:dpconfig="http://www.datapower.com/param/config">
              <xsl:param name="dpconfig:MyParam" select="'xyz'"/>
              </xsl:stylesheet

              I am using the following

              */*/xml/action? Name=WS_Proxy_Gateway_Name&Property=StylesheetParameters/ParameterValue&Value=< MyParam > ,

              But I am not sure how to define when different param values assign to same param Name in different style sheets for the same WS proxy gateway .
              I am wondering is there a way to define deployment policy based on rule instead of WS Proxy Gateway ,

              Please share your experience.
  • SystemAdmin
    SystemAdmin
    6772 Posts
    ACCEPTED ANSWER

    Re: Changing style sheet param value using deployment policy

    ‏2013-01-31T21:32:28Z  in response to sam4u
    try
    */*/services/multiprotocol-gateway?Name=MPG_Param&Property=StylesheetParameters/ParameterValue&Value=.MyParam.

    Also make sure that, once you import the MPGW, the stylesheet parameter value is changed ( on stlysheet params tab).

    Are you reassigning the value to the xsl variable?
    Do you have a statement like below?
    <xsl:variable name="MyParam" select="$dpconfig:MyParam" />
    This stmt will get current value from MPGW.
    In short, in ur xslt you should have these two stmnts
    <xsl:param name="dpconfig:MyParam" select="'abc'"/>
    <xsl:variable name="MyParam" select="$dpconfig:MyParam" />
    • sam4u
      sam4u
      12 Posts
      ACCEPTED ANSWER

      Re: Changing style sheet param value using deployment policy

      ‏2013-02-01T15:03:09Z  in response to SystemAdmin
      Hi,

      Thanks for your response.

      Just for your information , my XSL is loooking like:::

      <?xml version="1.0" encoding="UTF-8"?>
      <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dp="http://www.datapower.com/extensions" xmlns:dpconfig="http://www.datapower.com/param/config">
      <xsl:param name="dpconfig:MyParam" select="'abc'"/>
      <xsl:variable name="var_param" select="$dpconfig:MyParam"/>
      </xsl:stylesheet>

      I did not add any parameter explicitly in advance tab.

      After using this XSL, I found that one parameter was automatically created in transform cation -> advance tab. I had provided a value "paramvalue" there.

      I have tried both the below configuration match in deployment policy but the param value is not getting changed in transform cation -> advance tab.. parameter value.

      */*/services/multiprotocol-gateway?Name=MPG_Param&Property=StylesheetParameters/ParameterValue&Value=.MyParam

      */*/services/multiprotocol-gateway?Name=MPG_Param&Property=StylesheetParameters/ParameterValue&Value=.*

      Kindly let me know if I have done something wrong here.

      Regards,
      Sam
      • PullMeOut
        PullMeOut
        47 Posts
        ACCEPTED ANSWER

        Re: Changing style sheet param value using deployment policy

        ‏2013-02-05T02:07:41Z  in response to sam4u
        I am trying to create a similar deployment policy , i am using web service proxy with a request rule and response rule , I have 2 styles sheet , where the 2 style sheets has same param name with different Param value ,how can I differentiate this in deployment policy ....

        Style sheet 1 :

        <?xml version="1.0" encoding="UTF-8"?>
        <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dp="http://www.datapower.com/extensions" xmlns:dpconfig="http://www.datapower.com/param/config">
        <xsl:param name="dpconfig:MyParam" select="'abc'"/>
        </xsl:stylesheet

        Style sheet 2 :
        <?xml version="1.0" encoding="UTF-8"?>
        <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dp="http://www.datapower.com/extensions" xmlns:dpconfig="http://www.datapower.com/param/config">
        <xsl:param name="dpconfig:MyParam" select="'xyz'"/>
        </xsl:stylesheet

        I am using the following

        */*/xml/action? Name=WS_Proxy_Gateway_Name&Property=StylesheetParameters/ParameterValue&Value=< MyParam > ,

        But I am not sure how to define when different param values assign to same param Name in different style sheets for the same WS proxy gateway .
        I am wondering is there a way to define deployment policy based on rule instead of WS Proxy Gateway ,

        Please share your experience
        • Liv2luv
          Liv2luv
          573 Posts
          ACCEPTED ANSWER

          Re: Changing style sheet param value using deployment policy

          ‏2013-02-05T14:30:51Z  in response to PullMeOut
          For handling different parameter values for the same action, the parameters must NOT be defined in the 'Headers/Params' tab of the corresponding WSProxy. Instead having the parameters defined on the advanced tab of the corresponding action will let you refer each action and update the value accordingly.

          Example:

          */*/xml/action?Name=someMPG_xformbin_0&property=StylesheetParameters/ParameterValue&Value=X
          */*/xml/action?Name=someMPG_xformbin_1&property=StylesheetParameters/ParameterValue&Value=Y

          pls see the difference in action names above.