Topic
  • 11 replies
  • Latest Post - ‏2013-08-15T19:10:48Z by CQ9C_Renato_Zancoper
9XPM_Renato_Zancoper
4 Posts

Pinned topic Enabling/Disabling a xmlfirewall using SOMA/APM call

‏2013-07-30T10:43:59Z |

Hi all,

I am trying to migrate some scripts that I have to automate admin tasks. Currently these scripts are coded using CLI commands, and I want to migrate to SOMA calls. I was able to properly code SOMA XML Requests to perform usual domains tasks (quiesce/unquiesce/restart) and cache maintenance.

However, currently I am stucked on get a xmlfirewall enabled/disabled using SOMA

Can someone provide a generic XML Request for that task ?

 

Regards

Renato

  • CQ9C_Renato_Zancoper
    6 Posts
    ACCEPTED ANSWER

    Re: Enabling/Disabling a xmlfirewall using SOMA/APM call

    ‏2013-08-08T04:43:55Z  

    Hi everyone back,

    I could reach the the desired results using this request xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
        <env:Body>
            <dp:request xmlns:dp="http://www.datapower.com/schemas/management" domain="mydomain">
                <dp:modify-config>
                    <XMLFirewallService name="myxmlfw">
                        <mAdminState>disabled</mAdminState>
                    </XMLFirewallService>
                </dp:modify-config>
            </dp:request>

            <!--You want to save the datapower objects as you are saving in webgui, so this can be done by the following script-->
            <dp:request xmlns:dp="http://www.datapower.com/schemas/management" domain="mydomain">
                <dp:do-action>
                    <SaveConfig/>
                </dp:do-action>
            </dp:request>
        </env:Body>
    </env:Envelope>
     

    The only issue now is that usually I pipe the result to xmllint to get a iddented output, however, when I use 2 requests in the save envelope, xmllint is not able to properly parse/format the output. I usually run:

    curl -k -u me:'mypwd' -d @request.xml 
    https://mydp:5550/service/mgmt/current | xmllint --format -
    

     

    Updated on 2013-08-08T04:45:34Z at 2013-08-08T04:45:34Z by CQ9C_Renato_Zancoper
  • swlinn
    swlinn
    1395 Posts
    ACCEPTED ANSWER

    Re: Enabling/Disabling a xmlfirewall using SOMA/APM call

    ‏2013-08-08T10:57:30Z  

    Hi everyone back,

    I could reach the the desired results using this request xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
        <env:Body>
            <dp:request xmlns:dp="http://www.datapower.com/schemas/management" domain="mydomain">
                <dp:modify-config>
                    <XMLFirewallService name="myxmlfw">
                        <mAdminState>disabled</mAdminState>
                    </XMLFirewallService>
                </dp:modify-config>
            </dp:request>

            <!--You want to save the datapower objects as you are saving in webgui, so this can be done by the following script-->
            <dp:request xmlns:dp="http://www.datapower.com/schemas/management" domain="mydomain">
                <dp:do-action>
                    <SaveConfig/>
                </dp:do-action>
            </dp:request>
        </env:Body>
    </env:Envelope>
     

    The only issue now is that usually I pipe the result to xmllint to get a iddented output, however, when I use 2 requests in the save envelope, xmllint is not able to properly parse/format the output. I usually run:

    <pre dir="ltr">curl -k -u me:'mypwd' -d @request.xml https://mydp:5550/service/mgmt/current | xmllint --format - </pre>

     

    For something this simple, you can put them into one request and use the /service/mgmt/2004 URI,

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
        <env:Body>
            <dp:request xmlns:dp="http://www.datapower.com/schemas/management" domain="mydomain">
                <dp:modify-config>
                    <XMLFirewallService name="myxmlfw">
                        <mAdminState>disabled</mAdminState>
                    </XMLFirewallService>
                </dp:modify-config>
                <dp:do-action>
                    <SaveConfig/>
                </dp:do-action>
            </dp:request>
        </env:Body>
    </env:Envelope>

    Regards,

    Steve

  • swlinn
    swlinn
    1395 Posts
    ACCEPTED ANSWER

    Re: Enabling/Disabling a xmlfirewall using SOMA/APM call

    ‏2013-08-15T17:43:27Z  

    Hi Steve,

    I think you didn't got what I meant ...
    My problem in not on how to push two commands in the same request, but on parsing the response for that

    I have scripts calling curl to send the SOMA request xml to DP and then, it parses the response file. I use to call curl piped to xmllint to get a iddented response xml like this:
    curl -s -k -u myid:'mypwd' -d @myrequest.xml https://myappliance:5550/service/mgmt/current | xmllint --format --output dpresponse.xml -

    ... the problem is that if I send more then 1 command (in this case, the modify-config for XMLFirewallService and SaveConfig) both commands are well processed by DP, but xmllint is unable to parse the response xml.
    It fails exactly where the envelope for the second command starts, like this:

    curl -s -k -u myid:'mypwd' -d @myrequest.xml 
    https://myappliance:5550/service/mgmt/current | xmllint --format --output dpresponse.xml -
    -:186: parser error : Extra content at the end of the document
    uiesceState/></DomainStatus></dp:status></dp:response></env:Body></env:Envelope>
                                                                                   ^
    

    * this is not the real response, I just got an example that just show domain status as I would not be able to stop anything right now, but the concept is the same.
    Note that it stop to parse the response exactly where the first envelope ends, and before the second response starts

    How to circunvent this behavior, and get a formated output in a case like that (using command line tool, that I would be able to use in a script)

    Regards
    Renato

    Hi Renato,

    I understand the issue perfectly.  When you send the requests like you were doing with two dp:requests within the same soap body, you get a two consecutive soap responses.  I changed your above SOMA XML to be one for my own domain and service, and this is the response I get:

    <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
        <env:Body>
            <dp:response xmlns:dp="http://www.datapower.com/schemas/management">
                <dp:timestamp>2013-08-12T14:03:50-04:00</dp:timestamp>
                <dp:result>OK</dp:result>
            </dp:response>
        </env:Body>
    </env:Envelope>
    <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
        <env:Body>
            <dp:response xmlns:dp="http://www.datapower.com/schemas/management">
                <dp:timestamp>2013-08-12T14:03:51-04:00</dp:timestamp>
                <dp:result>OK</dp:result>
            </dp:response>
         </env:Body>
    </env:Envelope>

    Note that the above is malformed XML as you do not have a encompassing element but two peer <env:Envelope> elements, thus why you cannot parse it.  Now if you changed to my approach, you only get one soap response as follows:

    <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
        <env:Body>
            <dp:response xmlns:dp="http://www.datapower.com/schemas/management">
                <dp:timestamp>2013-08-12T14:08:56-04:00</dp:timestamp>
                <dp:result>OK</dp:result>
                <dp:result>OK</dp:result>
            </dp:response>
        </env:Body>
    </env:Envelope>
     

    This is well formed XML, the first dp:result is for my modify-config, the second is for my SaveConfig.

    For simple things as you are attempting, you can have multiple actions, in this case, dp:modify-config and dp:do-action, in the same dp:request when using the legacy XMI schema.  If using features though only supported by the current XMI schema, you must have completely separate XML requests sent to the appliance and not combine them in one XML document sent to XMI.  If this is your case, you must use curl to send the modify-config request and check of OK, then another curl to do the do-action, check for OK for its response.

    Regards,
    Steve

  • Miel
    Miel
    50 Posts

    Re: Enabling/Disabling a xmlfirewall using SOMA/APM call

    ‏2013-07-30T11:30:49Z  

    Hi Renato,

                       Try the below AMP call to stop (disable) the particular service.

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.datapower.com/schemas/appliance/management/3.0">
       <soapenv:Header/>
       <soapenv:Body>
          <ns:StopServiceRequest>
             <ns:Domain>YourDomain</ns:Domain>
             <ns:Services>
                    <ns:Object name="ServiceObjectName" class-name="ServiceClassName" class-display-name="?"/>
             </ns:Services>
          </ns:StopServiceRequest>
       </soapenv:Body>
    </soapenv:Envelope>

    Regards,

    Miel.

    Note:

    class-display-name is optional

     

  • David07
    David07
    76 Posts

    Re: Enabling/Disabling a xmlfirewall using SOMA/APM call

    ‏2013-07-30T12:23:41Z  

    Hi Renato,

    Try with the below mentioned SOMA script to enable or disable xmlfirewall service,

     


    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.datapower.com/schemas/appliance/management/3.0">
    <soapenv:Header/>
    <soapenv:Body>
    <dp:request xmlns:dp="http://www.datapower.com/schemas/management">
    <dp:modify-config>
    <XMLFirewall name="Firewall_Name">
    <mAdminState>disabled</mAdminState>
    </XMLFirewall>
    </dp:modify-config>
    </dp:request>
    </soapenv:Body>
    </soapenv:Envelope>

     

    Regards,

    David.

  • 9XPM_Renato_Zancoper
    4 Posts

    Re: Enabling/Disabling a xmlfirewall using SOMA/APM call

    ‏2013-07-31T04:39:45Z  

    Miel & David,

    Thanks for your reply.

    I won't be able to test it tonight as my sandbox is locked by a tester, but probably tomorrow it will be free.

    Will post results as soon I test it

     

    Regards

    Renato

     

  • CQ9C_Renato_Zancoper
    6 Posts

    Re: Enabling/Disabling a xmlfirewall using SOMA/APM call

    ‏2013-08-08T04:43:55Z  

    Hi everyone back,

    I could reach the the desired results using this request xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
        <env:Body>
            <dp:request xmlns:dp="http://www.datapower.com/schemas/management" domain="mydomain">
                <dp:modify-config>
                    <XMLFirewallService name="myxmlfw">
                        <mAdminState>disabled</mAdminState>
                    </XMLFirewallService>
                </dp:modify-config>
            </dp:request>

            <!--You want to save the datapower objects as you are saving in webgui, so this can be done by the following script-->
            <dp:request xmlns:dp="http://www.datapower.com/schemas/management" domain="mydomain">
                <dp:do-action>
                    <SaveConfig/>
                </dp:do-action>
            </dp:request>
        </env:Body>
    </env:Envelope>
     

    The only issue now is that usually I pipe the result to xmllint to get a iddented output, however, when I use 2 requests in the save envelope, xmllint is not able to properly parse/format the output. I usually run:

    curl -k -u me:'mypwd' -d @request.xml 
    https://mydp:5550/service/mgmt/current | xmllint --format -
    

     

    Updated on 2013-08-08T04:45:34Z at 2013-08-08T04:45:34Z by CQ9C_Renato_Zancoper
  • swlinn
    swlinn
    1395 Posts

    Re: Enabling/Disabling a xmlfirewall using SOMA/APM call

    ‏2013-08-08T10:57:30Z  

    Hi everyone back,

    I could reach the the desired results using this request xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
        <env:Body>
            <dp:request xmlns:dp="http://www.datapower.com/schemas/management" domain="mydomain">
                <dp:modify-config>
                    <XMLFirewallService name="myxmlfw">
                        <mAdminState>disabled</mAdminState>
                    </XMLFirewallService>
                </dp:modify-config>
            </dp:request>

            <!--You want to save the datapower objects as you are saving in webgui, so this can be done by the following script-->
            <dp:request xmlns:dp="http://www.datapower.com/schemas/management" domain="mydomain">
                <dp:do-action>
                    <SaveConfig/>
                </dp:do-action>
            </dp:request>
        </env:Body>
    </env:Envelope>
     

    The only issue now is that usually I pipe the result to xmllint to get a iddented output, however, when I use 2 requests in the save envelope, xmllint is not able to properly parse/format the output. I usually run:

    <pre dir="ltr">curl -k -u me:'mypwd' -d @request.xml https://mydp:5550/service/mgmt/current | xmllint --format - </pre>

     

    For something this simple, you can put them into one request and use the /service/mgmt/2004 URI,

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
        <env:Body>
            <dp:request xmlns:dp="http://www.datapower.com/schemas/management" domain="mydomain">
                <dp:modify-config>
                    <XMLFirewallService name="myxmlfw">
                        <mAdminState>disabled</mAdminState>
                    </XMLFirewallService>
                </dp:modify-config>
                <dp:do-action>
                    <SaveConfig/>
                </dp:do-action>
            </dp:request>
        </env:Body>
    </env:Envelope>

    Regards,

    Steve

  • CQ9C_Renato_Zancoper
    6 Posts

    Re: Enabling/Disabling a xmlfirewall using SOMA/APM call

    ‏2013-08-15T17:16:54Z  
    • swlinn
    • ‏2013-08-08T10:57:30Z

    For something this simple, you can put them into one request and use the /service/mgmt/2004 URI,

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
        <env:Body>
            <dp:request xmlns:dp="http://www.datapower.com/schemas/management" domain="mydomain">
                <dp:modify-config>
                    <XMLFirewallService name="myxmlfw">
                        <mAdminState>disabled</mAdminState>
                    </XMLFirewallService>
                </dp:modify-config>
                <dp:do-action>
                    <SaveConfig/>
                </dp:do-action>
            </dp:request>
        </env:Body>
    </env:Envelope>

    Regards,

    Steve

    Hi Steve,

    I think you didn't got what I meant ...
    My problem in not on how to push two commands in the same request, but on parsing the response for that

    I have scripts calling curl to send the SOMA request xml to DP and then, it parses the response file. I use to call curl piped to xmllint to get a iddented response xml like this:
    curl -s -k -u myid:'mypwd' -d @myrequest.xml https://myappliance:5550/service/mgmt/current | xmllint --format --output dpresponse.xml -

    ... the problem is that if I send more then 1 command (in this case, the modify-config for XMLFirewallService and SaveConfig) both commands are well processed by DP, but xmllint is unable to parse the response xml.
    It fails exactly where the envelope for the second command starts, like this:

    curl -s -k -u myid:'mypwd' -d @myrequest.xml https://myappliance:5550/service/mgmt/current | xmllint --format --output dpresponse.xml -
    -:186: parser error : Extra content at the end of the document
    uiesceState/></DomainStatus></dp:status></dp:response></env:Body></env:Envelope>
                                                                                   ^
    

    * this is not the real response, I just got an example that just show domain status as I would not be able to stop anything right now, but the concept is the same.
    Note that it stop to parse the response exactly where the first envelope ends, and before the second response starts

    How to circunvent this behavior, and get a formated output in a case like that (using command line tool, that I would be able to use in a script)

    Regards
    Renato

    Updated on 2013-08-15T17:21:21Z at 2013-08-15T17:21:21Z by CQ9C_Renato_Zancoper
  • HermannSW
    HermannSW
    5816 Posts

    Re: Enabling/Disabling a xmlfirewall using SOMA/APM call

    ‏2013-08-15T17:36:50Z  

    Hi Steve,

    I think you didn't got what I meant ...
    My problem in not on how to push two commands in the same request, but on parsing the response for that

    I have scripts calling curl to send the SOMA request xml to DP and then, it parses the response file. I use to call curl piped to xmllint to get a iddented response xml like this:
    curl -s -k -u myid:'mypwd' -d @myrequest.xml https://myappliance:5550/service/mgmt/current | xmllint --format --output dpresponse.xml -

    ... the problem is that if I send more then 1 command (in this case, the modify-config for XMLFirewallService and SaveConfig) both commands are well processed by DP, but xmllint is unable to parse the response xml.
    It fails exactly where the envelope for the second command starts, like this:

    <pre dir="ltr" style="margin-left: 40px;">curl -s -k -u myid:'mypwd' -d @myrequest.xml https://myappliance:5550/service/mgmt/current | xmllint --format --output dpresponse.xml - -:186: parser error : Extra content at the end of the document uiesceState/></DomainStatus></dp:status></dp:response></env:Body></env:Envelope> ^ </pre>

    * this is not the real response, I just got an example that just show domain status as I would not be able to stop anything right now, but the concept is the same.
    Note that it stop to parse the response exactly where the first envelope ends, and before the second response starts

    How to circunvent this behavior, and get a formated output in a case like that (using command line tool, that I would be able to use in a script)

    Regards
    Renato

    I do not have access to my DataPower boxes the next 1.5 weeks and therefore cannot lookup store:///xml-mgmt-ops.xsd.

    But sending two <dp:request>s in s single SOAP call against "current" XML management endpoint sounds completely wrong to me and should result in an error response from what I can remember.

    Hermann.

  • swlinn
    swlinn
    1395 Posts

    Re: Enabling/Disabling a xmlfirewall using SOMA/APM call

    ‏2013-08-15T17:43:27Z  

    Hi Steve,

    I think you didn't got what I meant ...
    My problem in not on how to push two commands in the same request, but on parsing the response for that

    I have scripts calling curl to send the SOMA request xml to DP and then, it parses the response file. I use to call curl piped to xmllint to get a iddented response xml like this:
    curl -s -k -u myid:'mypwd' -d @myrequest.xml https://myappliance:5550/service/mgmt/current | xmllint --format --output dpresponse.xml -

    ... the problem is that if I send more then 1 command (in this case, the modify-config for XMLFirewallService and SaveConfig) both commands are well processed by DP, but xmllint is unable to parse the response xml.
    It fails exactly where the envelope for the second command starts, like this:

    <pre dir="ltr" style="margin-left: 40px;">curl -s -k -u myid:'mypwd' -d @myrequest.xml https://myappliance:5550/service/mgmt/current | xmllint --format --output dpresponse.xml - -:186: parser error : Extra content at the end of the document uiesceState/></DomainStatus></dp:status></dp:response></env:Body></env:Envelope> ^ </pre>

    * this is not the real response, I just got an example that just show domain status as I would not be able to stop anything right now, but the concept is the same.
    Note that it stop to parse the response exactly where the first envelope ends, and before the second response starts

    How to circunvent this behavior, and get a formated output in a case like that (using command line tool, that I would be able to use in a script)

    Regards
    Renato

    Hi Renato,

    I understand the issue perfectly.  When you send the requests like you were doing with two dp:requests within the same soap body, you get a two consecutive soap responses.  I changed your above SOMA XML to be one for my own domain and service, and this is the response I get:

    <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
        <env:Body>
            <dp:response xmlns:dp="http://www.datapower.com/schemas/management">
                <dp:timestamp>2013-08-12T14:03:50-04:00</dp:timestamp>
                <dp:result>OK</dp:result>
            </dp:response>
        </env:Body>
    </env:Envelope>
    <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
        <env:Body>
            <dp:response xmlns:dp="http://www.datapower.com/schemas/management">
                <dp:timestamp>2013-08-12T14:03:51-04:00</dp:timestamp>
                <dp:result>OK</dp:result>
            </dp:response>
         </env:Body>
    </env:Envelope>

    Note that the above is malformed XML as you do not have a encompassing element but two peer <env:Envelope> elements, thus why you cannot parse it.  Now if you changed to my approach, you only get one soap response as follows:

    <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
        <env:Body>
            <dp:response xmlns:dp="http://www.datapower.com/schemas/management">
                <dp:timestamp>2013-08-12T14:08:56-04:00</dp:timestamp>
                <dp:result>OK</dp:result>
                <dp:result>OK</dp:result>
            </dp:response>
        </env:Body>
    </env:Envelope>
     

    This is well formed XML, the first dp:result is for my modify-config, the second is for my SaveConfig.

    For simple things as you are attempting, you can have multiple actions, in this case, dp:modify-config and dp:do-action, in the same dp:request when using the legacy XMI schema.  If using features though only supported by the current XMI schema, you must have completely separate XML requests sent to the appliance and not combine them in one XML document sent to XMI.  If this is your case, you must use curl to send the modify-config request and check of OK, then another curl to do the do-action, check for OK for its response.

    Regards,
    Steve

  • CQ9C_Renato_Zancoper
    6 Posts

    Re: Enabling/Disabling a xmlfirewall using SOMA/APM call

    ‏2013-08-15T18:05:22Z  
    • HermannSW
    • ‏2013-08-15T17:36:50Z

    I do not have access to my DataPower boxes the next 1.5 weeks and therefore cannot lookup store:///xml-mgmt-ops.xsd.

    But sending two <dp:request>s in s single SOAP call against "current" XML management endpoint sounds completely wrong to me and should result in an error response from what I can remember.

    Hermann.

    Hermann,

    that worked! I really tried before post it here :-)

    but the problem is that the response that comes from DataPower would look like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Body>
    <dp:response xmlns:dp="http://www.datapower.com/schemas/management">
    <dp:timestamp>2013-08-15T09:59:55-06:00</dp:timestamp>
    ...
    </dp:response>
    </env:Body>
    </env:Envelope>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <env:Body>
    <dp:response xmlns:dp="http://www.datapower.com/schemas/management">
    <dp:timestamp>2013-08-15T09:59:55-06:00</dp:timestamp>
    ...
    </dp:response>
    </env:Body>
    </env:Envelope>
    

    (certainly not as pretty formatted as this)

    ... and when xmllint "see" the second envelope in a row, it throw an error formating it

    the commands are succesfully processed and responded by DataPower ... I just can format the response message to grep (or awk) what I need to show on the script output

    Regards

    Renato

  • CQ9C_Renato_Zancoper
    6 Posts

    Re: Enabling/Disabling a xmlfirewall using SOMA/APM call

    ‏2013-08-15T18:21:31Z  
    • swlinn
    • ‏2013-08-15T17:43:27Z

    Hi Renato,

    I understand the issue perfectly.  When you send the requests like you were doing with two dp:requests within the same soap body, you get a two consecutive soap responses.  I changed your above SOMA XML to be one for my own domain and service, and this is the response I get:

    <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
        <env:Body>
            <dp:response xmlns:dp="http://www.datapower.com/schemas/management">
                <dp:timestamp>2013-08-12T14:03:50-04:00</dp:timestamp>
                <dp:result>OK</dp:result>
            </dp:response>
        </env:Body>
    </env:Envelope>
    <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
        <env:Body>
            <dp:response xmlns:dp="http://www.datapower.com/schemas/management">
                <dp:timestamp>2013-08-12T14:03:51-04:00</dp:timestamp>
                <dp:result>OK</dp:result>
            </dp:response>
         </env:Body>
    </env:Envelope>

    Note that the above is malformed XML as you do not have a encompassing element but two peer <env:Envelope> elements, thus why you cannot parse it.  Now if you changed to my approach, you only get one soap response as follows:

    <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
        <env:Body>
            <dp:response xmlns:dp="http://www.datapower.com/schemas/management">
                <dp:timestamp>2013-08-12T14:08:56-04:00</dp:timestamp>
                <dp:result>OK</dp:result>
                <dp:result>OK</dp:result>
            </dp:response>
        </env:Body>
    </env:Envelope>
     

    This is well formed XML, the first dp:result is for my modify-config, the second is for my SaveConfig.

    For simple things as you are attempting, you can have multiple actions, in this case, dp:modify-config and dp:do-action, in the same dp:request when using the legacy XMI schema.  If using features though only supported by the current XMI schema, you must have completely separate XML requests sent to the appliance and not combine them in one XML document sent to XMI.  If this is your case, you must use curl to send the modify-config request and check of OK, then another curl to do the do-action, check for OK for its response.

    Regards,
    Steve

    Oh Steve,

    just now I noticed that on your xml you didn't closed/reopened the <dp:request> tag ... sorry about the distraction!

    I will try in that way!

    Thanks a lot

    Renato

  • CQ9C_Renato_Zancoper
    6 Posts

    Re: Enabling/Disabling a xmlfirewall using SOMA/APM call

    ‏2013-08-15T19:10:48Z  
    • swlinn
    • ‏2013-08-15T17:43:27Z

    Hi Renato,

    I understand the issue perfectly.  When you send the requests like you were doing with two dp:requests within the same soap body, you get a two consecutive soap responses.  I changed your above SOMA XML to be one for my own domain and service, and this is the response I get:

    <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
        <env:Body>
            <dp:response xmlns:dp="http://www.datapower.com/schemas/management">
                <dp:timestamp>2013-08-12T14:03:50-04:00</dp:timestamp>
                <dp:result>OK</dp:result>
            </dp:response>
        </env:Body>
    </env:Envelope>
    <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
        <env:Body>
            <dp:response xmlns:dp="http://www.datapower.com/schemas/management">
                <dp:timestamp>2013-08-12T14:03:51-04:00</dp:timestamp>
                <dp:result>OK</dp:result>
            </dp:response>
         </env:Body>
    </env:Envelope>

    Note that the above is malformed XML as you do not have a encompassing element but two peer <env:Envelope> elements, thus why you cannot parse it.  Now if you changed to my approach, you only get one soap response as follows:

    <env:Envelope xmlns:env="http://www.w3.org/2001/12/soap-envelope">
        <env:Body>
            <dp:response xmlns:dp="http://www.datapower.com/schemas/management">
                <dp:timestamp>2013-08-12T14:08:56-04:00</dp:timestamp>
                <dp:result>OK</dp:result>
                <dp:result>OK</dp:result>
            </dp:response>
        </env:Body>
    </env:Envelope>
     

    This is well formed XML, the first dp:result is for my modify-config, the second is for my SaveConfig.

    For simple things as you are attempting, you can have multiple actions, in this case, dp:modify-config and dp:do-action, in the same dp:request when using the legacy XMI schema.  If using features though only supported by the current XMI schema, you must have completely separate XML requests sent to the appliance and not combine them in one XML document sent to XMI.  If this is your case, you must use curl to send the modify-config request and check of OK, then another curl to do the do-action, check for OK for its response.

    Regards,
    Steve

    Worked fine here. Thanks againg Steve