Results 1 to 3 of 3

Thread: another SOAP related dumb question...

  1. #1
    antonio.meireles is offline Active Member
    Join Date
    Oct 2005
    Posts
    25
    Rep Power
    9

    Default another SOAP related dumb question... [forget - solved]

    Code:
    #!/usr/bin/ruby
    require 'http-access2'
    require 'soap/rpc/driver'
    require 'soap/driver'
    
    drv = SOAP::RPC::Driver.new('https://192.168.10.191:7071/', 'urn:zimbraAdmin')
    
    drv.wiredump_dev = STDERR  #if $DEBUG
    drv.options["protocol.http.ssl_config.verify_mode"] = nil 
    drv.options["protocol.http.basic_auth"]  << ['http://192.168.10.191:7071', 'admin@XXXXXX', 'XXXXX']
    p drv.add_method('GetAllAdminAccountsRequest')
    p drv.GetAllAdminAccountsRequest().call
    any hint why the above ruby call returns...

    Code:
    = Request
    
    ! CONNECT TO 192.168.10.191:7071
    ! CONNECTION ESTABLISHED
    at depth 0 - 18: self signed certificate
    POST / HTTP/1.1
    SOAPAction: ""
    Content-Type: text/xml; charset=utf-8
    User-Agent: SOAP4R/1.5.5 (/114, ruby 1.8.3 (2005-09-21) [i686-linux])
    Date: Mon Oct 17 17:45:13 WEST 2005
    Content-Length: 428
    Host: 192.168.10.191:7071
    
    <?xml version="1.0" encoding="utf-8" ?>
    <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <env:Body>
        <n1:GetAllAdminAccountsRequest xmlns:n1="urn:zimbraAdmin"
            env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        </n1:GetAllAdminAccountsRequest>
      </env:Body>
    </env:Envelope>
    
    = Response
    
    HTTP/1.1 302 Moved Temporarily
    Server: Apache-Coyote/1.1
    Expires: Mon, 24 Oct 2005 16:43:22 GMT
    Cache-control: max-age:604800, must-revalidate
    Set-Cookie: JSESSIONID=F93E54662D82238BAD27208D2025F3E8; Path=/; Secure
    Location: https://192.168.10.191:7071/zimbraAdmin
    Content-Type: text/html;charset=ISO-8859-1
    Content-Length: 0
    Date: Mon, 17 Oct 2005 16:43:22 GMT
    
    = Request
    
    POST /zimbraAdmin HTTP/1.1
    SOAPAction: ""
    Content-Type: text/xml; charset=utf-8
    Cookie: JSESSIONID=F93E54662D82238BAD27208D2025F3E8
    User-Agent: SOAP4R/1.5.5 (/114, ruby 1.8.3 (2005-09-21) [i686-linux])
    Date: Mon Oct 17 17:45:13 WEST 2005
    Content-Length: 428
    Host: 192.168.10.191:7071
    
    <?xml version="1.0" encoding="utf-8" ?>
    <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <env:Body>
        <n1:GetAllAdminAccountsRequest xmlns:n1="urn:zimbraAdmin"
            env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        </n1:GetAllAdminAccountsRequest>
      </env:Body>
    </env:Envelope>
    
    = Response
    
    HTTP/1.1 302 Moved Temporarily
    Server: Apache-Coyote/1.1
    Location: https://192.168.10.191:7071/zimbraAdmin/
    Transfer-Encoding: chunked
    Date: Mon, 17 Oct 2005 16:43:22 GMT
    
    0
    
    = Request
    
    POST /zimbraAdmin/ HTTP/1.1
    SOAPAction: ""
    Content-Type: text/xml; charset=utf-8
    Cookie: JSESSIONID=F93E54662D82238BAD27208D2025F3E8
    User-Agent: SOAP4R/1.5.5 (/114, ruby 1.8.3 (2005-09-21) [i686-linux])
    Date: Mon Oct 17 17:45:13 WEST 2005
    Content-Length: 428
    Host: 192.168.10.191:7071
    
    <?xml version="1.0" encoding="utf-8" ?>
    <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <env:Body>
        <n1:GetAllAdminAccountsRequest xmlns:n1="urn:zimbraAdmin"
            env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        </n1:GetAllAdminAccountsRequest>
      </env:Body>
    </env:Envelope>
    
    = Response
    
    HTTP/1.1 200 OK
    Server: Apache-Coyote/1.1
    Expires: Thu, 3 Nov 2005 17:23:51 GMT
    Cache-control: max-age:31536000, must-revalidate
    Set-Cookie: JSESSIONID=BCC1B34B6333112258C7640A561B8A8A; Path=/zimbraAdmin; Secure
    Content-Type: text/html;charset=ISO-8859-1
    Content-Language: en-US
    Transfer-Encoding: chunked
    Date: Mon, 17 Oct 2005 16:43:22 GMT
    
    (...)
    and not the expected answer ?


    Thanxs in advance.
    Last edited by antonio.meireles; 10-17-2005 at 10:35 AM.

  2. #2
    anand is offline Zimbra Employee
    Join Date
    Sep 2005
    Posts
    274
    Rep Power
    9

    Default URL for SOAP is different from UI url.

    URL should contain /service/soap/

    Code:
    drv = SOAP::RPC::Driver.new('https://192.168.10.191:7071/', 'urn:zimbraAdmin')
    vs

    Code:
    drv = SOAP::RPC::Driver.new('https://192.168.10.191:7071/service/soap/', 'urn:zimbraAdmin')
    I am almost sure the trailing slash is required (tomcat, not us) - try it with and without.

  3. #3
    bhwang is offline Zimbra Employee
    Join Date
    Sep 2005
    Posts
    6
    Rep Power
    9

    Default

    There are several issues with the script that you provided so that it won't work with Zimbra server

    1) As OP stated, the url is incorrect
    2) Authentication process is in Zimbra layer not in SSL layer therefore login soap request has to be sent to Zimbra server first to obtain session and token ids.

    Here is a rather crude and simple ruby script to issue 'GetAllAdminAccountsRequest'

    Hope it helps

    Bill

    Code:
    #!/usr/bin/ruby
    require 'soap/rpc/driver'
    require 'soap/driver'
    require 'soap/header/simplehandler'
    
    class ClientAuthHeaderHandler < SOAP::Header::SimpleHandler
        MyHeaderName = XSD::QName.new("urn:zimbra", "context")
        
        def initialize(sessionid = nil, authtoken = nil)
          super(MyHeaderName)
          @sessionid = sessionid
          @authtoken = authtoken       
        end
        
        def on_simple_outbound
          if @sessionid
            { "sessionId" => @sessionid, "authToken" => @authtoken }
          end     
        end 
    end
    
    drv = SOAP::RPC::Driver.new('https://foo.zimbra.com:7071/service/admin/soap/', 'urn:zimbraAdmin')
    
    drv.wiredump_dev = STDERR  #if $DEBUG
    drv.options["protocol.http.ssl_config.verify_mode"] = nil 
    drv.add_method('GetAllAdminAccountsRequest')
    drv.add_method('AuthRequest',"name", "password")
    
    token, lifetime, sessionid = drv.AuthRequest('admin@foo.zimbra.com','zimbra')
    drv.headerhandler << ClientAuthHeaderHandler.new(sessionid, token) 
    p drv.GetAllAdminAccountsRequest()
    Last edited by bhwang; 10-17-2005 at 12:03 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Zimbra SOAP Question
    By jonnybravo in forum Developers
    Replies: 8
    Last Post: 07-26-2007, 04:09 PM
  2. Spam question (all related)
    By dlochart in forum Administrators
    Replies: 3
    Last Post: 07-24-2007, 08:58 AM
  3. SOAP question
    By dbarnett in forum Developers
    Replies: 6
    Last Post: 11-17-2006, 11:48 AM
  4. Question on SOAP compatibility
    By Robin Diederen in forum Developers
    Replies: 3
    Last Post: 09-19-2006, 01:26 AM
  5. SOAP - dumb question of the day
    By antonio.meireles in forum Developers
    Replies: 1
    Last Post: 10-14-2005, 09:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •