Topic
  • 7 replies
  • Latest Post - ‏2013-11-18T17:08:58Z by HermannSW
thotranh
thotranh
92 Posts

Pinned topic Restart Domain via a Web Service

‏2013-11-01T21:05:08Z |

I'd like to invoke a web service on the DataPower to restart a domain . Is it possible ?

(External Client ---------> http://datapower-ip:port/restartDomain/myDevDomain  ----------->  actually restart the domain as if you'd click on the "Restart Domain" option).

 

Please let me know if you know a best way to do it .  This would help us on automating some of our deployment process

Thank you

  • HermannSW
    HermannSW
    5834 Posts

    Re: Restart Domain via a Web Service

    ‏2013-11-03T21:05:07Z  

    Hi,

    in order to restart a domain you need access to either the WebGUI, the XML management interface or the CLI.

    This posting explains how to executed an XML management reqest from within a stylesheet (allowing for your service):
    https://www.ibm.com/developerworks/community/blogs/HermannSW/entry/accessing_xml_management_interface_from_within_a_stylesheet38

    For the link at bottom of this posting you can see how the SOMA command has to look:
    https://www.ibm.com/developerworks/community/blogs/HermannSW/entry/xml_management_sample_requests36

    <RestartDomain>
      <Domain class="?">?</Domain>
    </RestartDomain>


    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>

     

  • thotranh
    thotranh
    92 Posts

    Re: Restart Domain via a Web Service

    ‏2013-11-14T23:02:13Z  
    • HermannSW
    • ‏2013-11-03T21:05:07Z

    Hi,

    in order to restart a domain you need access to either the WebGUI, the XML management interface or the CLI.

    This posting explains how to executed an XML management reqest from within a stylesheet (allowing for your service):
    https://www.ibm.com/developerworks/community/blogs/HermannSW/entry/accessing_xml_management_interface_from_within_a_stylesheet38

    For the link at bottom of this posting you can see how the SOMA command has to look:
    https://www.ibm.com/developerworks/community/blogs/HermannSW/entry/xml_management_sample_requests36

    <RestartDomain>
      <Domain class="?">?</Domain>
    </RestartDomain>


    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>

     

    Thanks.

    I have the XSL ready with the dp:soap-call with the Envelope to restart a domain .

    However, I would like to use this XSL for a LoopBack-Proxy XML Manager so that I can just hit it  http:<dp IP>:<port>/ without providing any payload/XML data. 

    It doesn't seem possible with an XML Manager since it always gives the error "Request method GET without a message body is not allowed".

    What service should I create to make use of this XSL (to restart a domain) ? There's no back-end for this.  THe restarting of the domain is done locally within the DP .

    Please help

    Thanks

  • HermannSW
    HermannSW
    5834 Posts

    Re: Restart Domain via a Web Service

    ‏2013-11-15T07:41:04Z  
    • thotranh
    • ‏2013-11-14T23:02:13Z

    Thanks.

    I have the XSL ready with the dp:soap-call with the Envelope to restart a domain .

    However, I would like to use this XSL for a LoopBack-Proxy XML Manager so that I can just hit it  http:<dp IP>:<port>/ without providing any payload/XML data. 

    It doesn't seem possible with an XML Manager since it always gives the error "Request method GET without a message body is not allowed".

    What service should I create to make use of this XSL (to restart a domain) ? There's no back-end for this.  THe restarting of the domain is done locally within the DP .

    Please help

    Thanks

    Please set "Process Messages Whose Body Is Empty" to "On" on Advanced tab of the service.

    From WebGUI online help:

    Process Messages Whose Body Is Empty

    Some message patterns could include bodyless request and response messages. This approach is common with RESTful Web services where messages might not include a body but still requires the processing policy to run. To enable this capability for services whose request and response type is XML, JSON, or marked as non-XML, set this option to 'on'. By doing so, the processing policy rules will always be run.


    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>

  • thotranh
    thotranh
    92 Posts

    Re: Restart Domain via a Web Service

    ‏2013-11-15T19:10:23Z  
    • HermannSW
    • ‏2013-11-15T07:41:04Z

    Please set "Process Messages Whose Body Is Empty" to "On" on Advanced tab of the service.

    From WebGUI online help:

    Process Messages Whose Body Is Empty

    Some message patterns could include bodyless request and response messages. This approach is common with RESTful Web services where messages might not include a body but still requires the processing policy to run. To enable this capability for services whose request and response type is XML, JSON, or marked as non-XML, set this option to 'on'. By doing so, the processing policy rules will always be run.


    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>

    Thanks for your help.

    Question : is there a way to avoid putting the username:password in the restart-domain XSL that you provided ? (soma:secret)
      <xsl:variable name="pwd64" select="dp:encode('soma:secret','base-64')"/>

    We need to CM / check it in to SVN our XSL files , and having clear-text password in the file is not acceptable.

    Please advise !

     

  • HermannSW
    HermannSW
    5834 Posts

    Re: Restart Domain via a Web Service

    ‏2013-11-15T21:12:55Z  
    • thotranh
    • ‏2013-11-15T19:10:23Z

    Thanks for your help.

    Question : is there a way to avoid putting the username:password in the restart-domain XSL that you provided ? (soma:secret)
      <xsl:variable name="pwd64" select="dp:encode('soma:secret','base-64')"/>

    We need to CM / check it in to SVN our XSL files , and having clear-text password in the file is not acceptable.

    Please advise !

     

    The user name/password is need for Basic Auth.

    If you would pass the Authorization header with your client request to DataPower, it does not need to be stored there.

    "curl" allows to just specify "-u soma:secret" and does the base64 encoding for you.


    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>

  • thotranh
    thotranh
    92 Posts

    Re: Restart Domain via a Web Service

    ‏2013-11-18T15:42:59Z  
    • HermannSW
    • ‏2013-11-15T21:12:55Z

    The user name/password is need for Basic Auth.

    If you would pass the Authorization header with your client request to DataPower, it does not need to be stored there.

    "curl" allows to just specify "-u soma:secret" and does the base64 encoding for you.


    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>

    Thanks, Hermann.

    I've got all this working , thanks for your great help from the links.

    However, I've got a requirement from my team lead to accomplish this "Restart Domain" DP service:

    - configure a DP service (eg. XML Manager) to : 1/ authenticate incoming request against our own system ,etc.  2/ have the XSL to do the domain restarting WITHOUT needing a DP's account (no need to create "soma" account).

    Is it possible that, if an incoming request can be authenticated against our own system (LDAP, DB, whatever it is, not authenticated against a local DP account), then we can do the "restarting domain" without needing a DP's admin account ?

    Please advise.

  • HermannSW
    HermannSW
    5834 Posts

    Re: Restart Domain via a Web Service

    ‏2013-11-18T17:08:58Z  
    • thotranh
    • ‏2013-11-18T15:42:59Z

    Thanks, Hermann.

    I've got all this working , thanks for your great help from the links.

    However, I've got a requirement from my team lead to accomplish this "Restart Domain" DP service:

    - configure a DP service (eg. XML Manager) to : 1/ authenticate incoming request against our own system ,etc.  2/ have the XSL to do the domain restarting WITHOUT needing a DP's account (no need to create "soma" account).

    Is it possible that, if an incoming request can be authenticated against our own system (LDAP, DB, whatever it is, not authenticated against a local DP account), then we can do the "restarting domain" without needing a DP's admin account ?

    Please advise.

    1) you can do with AAA action.

    2) not possible, sorry (you have to go through XML Management interface, and that requires account)


    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>