Topic
17 replies Latest Post - ‏2013-08-08T13:54:33Z by XIntegration50
VjayP
VjayP
11 Posts
ACCEPTED ANSWER

Pinned topic How to call DataPower XML Management Interface (SOMA) from SoapUI

‏2010-09-23T05:57:08Z |
Hi All,
I am new to DataPower and SOMA.

I have searched the forums for my issue and have tried all that has been suggested but have been unable to resolve it.

I am trying to execute a simple SOMA script via Soap UI and am getting errors. I can execute the same script using cURL.

The following works via cURL -

curl -k -d@Req.xml -H "Content-Type: application/soap+xml;charset=UTF-8" -u user:passwd https://x.x.x.x:yyyy/service/mgmt/current

The content of Req.xml is as follows -


<soapenv:Envelope xmlns:soapenv=
"http://schemas.xmlsoap.org/soap/envelope/" xmlns:dp=
"http://www.datapower.com/schemas/management"> <soapenv:Header/> <soapenv:Body> <dp:request domain=
"X_Domain"> <dp:do-action> <FlushStylesheetCache> <XMLManager>MyXMLManager</XMLManager> </FlushStylesheetCache> <SaveConfig/> </dp:do-action> </dp:request> </soapenv:Body> </soapenv:Envelope>


Based on what I found on the forums, I have tried the following in SoapUI -

1) Set Username & Password for the request in the 'Aut' section. I tried by setting the actual values and also Base64 encoded values, both did not help!

2) Set the request Header "Authorization" to value "Basic user:password" where user:password is the Base64 encoded string.

My issue is very confusing as I do not get any response body. When I look at the response headers, I see the following -

X-Squid-Error: ERR_ACCESS_DENIED 0
Date: Thu, 23 Sep 2010 05:43:47 GMT
#status#: HTTP/1.0 403 Forbidden
Content-Length: 1072
Expires: Thu, 23 Sep 2010 05:43:47 GMT
Content-Type: text/html
X-Cache: MISS from xyzserver
Mime-Version: 1.0
Server: squid/2.5.STABLE13
Proxy-Connection: close

I see no errors/ messages in DataPower's default-log.

What am I doing wrong?

Any assistance is much appreciated.

Thank you in advance!

Vijay
Updated on 2012-12-10T14:39:27Z at 2012-12-10T14:39:27Z by PullMeOut
  • SystemAdmin
    SystemAdmin
    6772 Posts
    ACCEPTED ANSWER

    Re: How to call DataPower XML Management Interface (SOMA) from SoapUI

    ‏2010-09-23T06:11:28Z  in response to VjayP
    You have kept the wrong username and password in the SOAPUI .. In soapUi there is a option where you have to provide the base64 encoded password .. that you can do online or simple base64 convertion ..

    Why don't you install curl in your machine ..and check your responses ...
    • VjayP
      VjayP
      11 Posts
      ACCEPTED ANSWER

      Re: How to call DataPower XML Management Interface (SOMA) from SoapUI

      ‏2010-09-23T06:33:54Z  in response to SystemAdmin
      Hi Kumar,
      Thanks for the reply.

      "In soapUi there is a option where you have to provide the base64 encoded password .. that you can do online or simple base64 convertion .."

      I already have the Base64 values for both username and password. Can you please point me where I can set these values in SoapUI?

      The reason why I want to do this in SoapUI is because I need to modify some configuration while testing the services deployed on DataPower.
      I have a lot of tests in SoapUI and felt it will be better to execute SOMA scripts via SoapUI as well.

      Thanks,
      Vijay
  • SystemAdmin
    SystemAdmin
    6772 Posts
    ACCEPTED ANSWER

    Re: How to call DataPower XML Management Interface (SOMA) from SoapUI

    ‏2010-09-23T06:38:18Z  in response to VjayP
    I never tried sending request using soap UI .. but there is option called as Aut .. when you will have the request .. and there other option called as header .. add the http header .. In Aut there is option of username and password ..

    Hope it helps you .. but many ppl do via install SVN or install curl for windows or cygwin ...
    • VjayP
      VjayP
      11 Posts
      ACCEPTED ANSWER

      Re: How to call DataPower XML Management Interface (SOMA) from SoapUI

      ‏2010-09-23T07:09:28Z  in response to SystemAdmin
      Hi Kumar,
      I have tried by setting the encoded and actual username & password values in the 'Aut' section in SoapUI.
      I still get the same error. Thank you for trying.

      Has anyone been able to use SoapUI to execute SOMA scripts?

      Thanks in advance!

      Vijay
      • Liv2luv
        Liv2luv
        573 Posts
        ACCEPTED ANSWER

        Re: How to call DataPower XML Management Interface (SOMA) from SoapUI

        ‏2010-09-23T17:39:21Z  in response to VjayP
        > I have tried by setting the encoded and actual username & password values in the 'Aut' section in SoapUI. I still get the same error

        In SOAP UI Preferences, HTTP settings tab enable Authenticate Preemptively

        Thanks.
        • VjayP
          VjayP
          11 Posts
          ACCEPTED ANSWER

          Re: How to call DataPower XML Management Interface (SOMA) from SoapUI

          ‏2010-09-23T22:28:00Z  in response to Liv2luv
          Hi Liv2luv,
          Sorry about the delay in replying. I just came in to work.

          I have enabled that option but I get the same error.

          Can you please tell me what I should do with regards to the Username and Password in 'Aut' section? Should I -

          1) Enter Base64 encoded values for both username and password or

          2) Enter plain text values for both username and password

          Also, do I have to add any HTTP headers in the Headers section?

          I am wondering if I have somehow setup the SoapUI project incorrectly. I created the project by downloading all the xsd files (xml-mgmt-base.xsd, xml-mgmt-ops.xsd, xml-mgmt.xsd) and the WSDL (xml-mgmt.wsdl) to my local machine and giving the WSDL path in SoapUI to my local directory. Can this be an issue?

          Thank you very much for helping out!

          Vijay
          • HermannSW
            HermannSW
            2818 Posts
            ACCEPTED ANSWER

            Re: How to call DataPower XML Management Interface (SOMA) from SoapUI

            ‏2010-09-23T23:06:49Z  in response to VjayP
            > 1) Enter Base64 encoded values for both username and password or

            I have not tried this with SOAPui.

            But the option "-u user:passwd" in curl sends base64('user:passwd') as a single string in the request header.
            And it prepends "Basic: ".

            I used that to avoid having to use an external base64 encoder for xpath++ tool:
            https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14511881&#14469630

            curl -u "$1:" ... just sends 1st paramenter with empty "password".
            Getting the value "$1" back in XSLT (without the appended colon is then done by this:
            
            <xsl:variable name=
            "auth" select=
            "dp:http-request-header('Authorization')"/> <xsl:variable name=
            "b64" select=
            "substring-after($auth,'Basic ')"/> <xsl:variable name=
            "user_" select=
            "dp:binary-decode($b64)"/> <xsl:value-of select=
            "substring($user_,1,string-length($user_)-1)"/>
            

            So please try to use base64('user:passwd'), probably together with 'Basic: '.
            Or find the correct option setting that make SOAPui handle this for you (like curl does).

            The simplest you can do to debug your issue is taking a packet capture and inspecting it with eg. Wireshark.
            Do this once for working curl solution and once for SOAPui -- the differnce might guide you into the right direction.

            Hermann.
            • VjayP
              VjayP
              11 Posts
              ACCEPTED ANSWER

              Re: How to call DataPower XML Management Interface (SOMA) from SoapUI

              ‏2010-09-24T00:16:21Z  in response to HermannSW
              Hi Hermann,
              Thanks for the advice.

              I have just tried something similar to what you suggested i.e., to debug the requests.

              I created a Web Service Proxy (WSP) to the SOMA interface and after looking through Probe I noticed that the request from SoapUI was missing the exact same header that you mentioned. :-)

              So, I added the "Authorization" header with value "Basic base64enc(username:passwd)" to the SoapUI request and called SOMA. It failed with the same error.

              However, I called the WSP from SoapUI and voila, it worked! :-)

              At least, I can use the WSP for now and until the main issue is fixed, I am happy with the workaround.

              I think I can not call SOMA interface from SoapUI due to some internal access/ permission issue and I will follow up with the guys here.

              The final solution that worked for me is -

              1) Adding "Authorization" header to the SoapUI request with the value "Basic base64enc(username:passwd)" Eg: Basic c29tZWJhc2U2NGVuY29kaW5n

              FYI, it works when the preference "Authenticate Preemptively" is both enabled and disabled.

              Thank you to everyone who has helped me. I appreciate all your help. :-)

              Vijay
              • PullMeOut
                PullMeOut
                39 Posts
                ACCEPTED ANSWER

                Re: How to call DataPower XML Management Interface (SOMA) from SoapUI

                ‏2012-12-07T20:47:37Z  in response to VjayP
                Vijay ,

                I am trying out similar test from SOAP URI , can you please toss some light from your experence

                1) Adding "Authorization" header to the SoapUI request with the value "Basic base64enc(username:passwd)" Eg: Basic c29tZWJhc2U2NGVuY29kaW5n

                Q) Do i need give space between Basic and username:pw
                Q) Do i need to convert even : to base64enc

                Basic(is space required after basic , if required do i need to convert space to base64enc

                it works when the preference "Authenticate Preemptively" is both enabled and disabled.

                Q) By default "Authenticate Preemptively" is enabled , do i need to disable it.
                Thanks in Advance
                • Daviiid
                  Daviiid
                  215 Posts
                  ACCEPTED ANSWER

                  Re: How to call DataPower XML Management Interface (SOMA) from SoapUI

                  ‏2012-12-10T13:10:14Z  in response to PullMeOut
                  Hello

                  You have to add a Http Header
                  Name : Authorization
                  Value : Basic user:password

                  Exemple, if your user/password is johndoe:JohnDoePassword, the http header Value is : Basic am9obmRvZTpKb2huRG9lUGFzc3dvcmQ=

                  screen shot is better that a explication :)
                  • PullMeOut
                    PullMeOut
                    39 Posts
                    ACCEPTED ANSWER

                    Re: How to call DataPower XML Management Interface (SOMA) from SoapUI

                    ‏2012-12-10T14:39:27Z  in response to Daviiid
                    thanks Vijay and David for your inputs . it is working now
  • VjayP
    VjayP
    11 Posts
    ACCEPTED ANSWER

    Re: How to call DataPower XML Management Interface (SOMA) from SoapUI

    ‏2010-09-24T00:18:11Z  in response to VjayP
    Thanks!
    • XIntegration50
      XIntegration50
      58 Posts
      ACCEPTED ANSWER

      Re: How to call DataPower XML Management Interface (SOMA) from SoapUI

      ‏2013-08-08T01:31:56Z  in response to VjayP

      Hi,

       

      I have seen this code above....  Can we give multiple actions like FlushStylesheetCache, SaveConfig under one 'do-action' ?

      
      <soapenv:Envelope xmlns:soapenv=
      "http://schemas.xmlsoap.org/soap/envelope/" xmlns:dp=
      "http://www.datapower.com/schemas/management"> <soapenv:Header/> <soapenv:Body> <dp:request domain=
      "X_Domain"> <dp:do-action> <FlushStylesheetCache> <XMLManager>MyXMLManager</XMLManager> </FlushStylesheetCache> <SaveConfig/> </dp:do-action> </dp:request> </soapenv:Body> </soapenv:Envelope>
      

       

      Thanks,

      Venkat

      Updated on 2013-08-08T03:34:31Z at 2013-08-08T03:34:31Z by XIntegration50
      • HermannSW
        HermannSW
        2818 Posts
        ACCEPTED ANSWER

        Re: How to call DataPower XML Management Interface (SOMA) from SoapUI

        ‏2013-08-08T02:50:52Z  in response to XIntegration50

        > Can we give multiple actions like FlushStylesheetCache, SaveConfig under one 'do-action' ?
        >
        Yes, because of  maxOccurs="unbounded".

        From "store:///xml-mgmt-ops.xsd":

        ...
        <!-- do action -->
        <xsd:element name="do-action" type="tns:AnyActionElement"/>
        ...


        From "store:///xml-mgmt.xsd":

        ...
        <xsd:complexType name="AnyActionElement">
          <xsd:choice maxOccurs="unbounded">
            <xsd:element name="AddKnownHost" type="tns:ActionAddKnownHost" />
        ...

         

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

        Updated on 2013-08-08T02:52:54Z at 2013-08-08T02:52:54Z by HermannSW
        • XIntegration50
          XIntegration50
          58 Posts
          ACCEPTED ANSWER

          Re: How to call DataPower XML Management Interface (SOMA) from SoapUI

          ‏2013-08-08T03:50:48Z  in response to HermannSW

          Hi Hermann,

          Thanks for the reply.

          Generally 'Choice' indicates that you must select any one of the member elements only right ? May be unbounded means the selected child element can be repeated any number of times ( I might be wrong ). That way I can repeat FlushStylesheetCache or someother child element is it ?

           

          SOAP UI:  xml-mgmt.wsdl

           <man:do-action>
                      <!--You have a CHOICE of the next 133 items at this level-->
           

          Thanks,

          Venkat

          • HermannSW
            HermannSW
            2818 Posts
            ACCEPTED ANSWER

            Re: How to call DataPower XML Management Interface (SOMA) from SoapUI

            ‏2013-08-08T08:04:00Z  in response to XIntegration50

            Hi Venkat,

            just <xsl:choice> has the default minOccurs=1 and maxOccurs=1.

            <xsl:choice maxOccurs="unbounded"> also has minOccurs=1 as default.
            So with that you can have arbitraryly many elements (at least 1), and all can be same of different.

            I have seen a customer SOMA request with more than 2800 <CreateDir>s in a singe <do-action> ...



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

            Updated on 2013-08-08T08:05:02Z at 2013-08-08T08:05:02Z by HermannSW
            • XIntegration50
              XIntegration50
              58 Posts
              ACCEPTED ANSWER

              Re: How to call DataPower XML Management Interface (SOMA) from SoapUI

              ‏2013-08-08T13:54:33Z  in response to HermannSW

              Thanks, I got it, Herman. Good to know how big SOMA requests does customer use.

              Venkat