Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Developers

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-13-2011, 11:58 AM
fgb fgb is offline
Junior Member
 
Posts: 8
Default Null response when sending a SOAP request to Zimbra server

Hello,

I am trying to send a SOAP request to Zimbra server in order to authenticate and perform admin tasks.

I am sure I am missing a point somewhere but can't find where.

Here is the SOAP request I am sending:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<context xmlns="urn:zimbra">
<nonotify/>
<noqualify/>
</context>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<AuthRequest xmlns="urn:zimbraAccount">
<name>admin@64bitad.int</name>
<password>password</password>
</AuthRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Here is the java code:

Code:
SOAPConnectionFactory sfc = SOAPConnectionFactory.newInstance();
		SOAPConnection connection = sfc.createConnection();
    	
    	MessageFactory mf = MessageFactory.newInstance();
        SOAPMessage sm = mf.createMessage();
        SOAPHeader sh = sm.getSOAPHeader();
        SOAPBody sb = sm.getSOAPBody();
        
        /* Build soap header */
        QName headerName = new QName("urn:zimbra", "context");
        SOAPHeaderElement headerElement = sh.addHeaderElement(headerName);
        QName noNotifyQName = new QName("nonotify");
        headerElement.addChildElement(noNotifyQName);
        
        QName noQualifyQName = new QName("noqualify");
        headerElement.addChildElement(noQualifyQName);

        /* Build soap body */
        QName serviceName = new QName("urn:zimbraAdmin", "AuthRequest");
        SOAPBodyElement bodyElement = sb.addBodyElement(serviceName);
        QName nameQn = new QName("name");
        SOAPElement nameElementValue = bodyElement.addChildElement(nameQn);
        nameElementValue.addTextNode("admin@64bitad.int");
        QName passwordQn = new QName("password");
        SOAPElement passwordElementValue = bodyElement.addChildElement(passwordQn);
        passwordElementValue.addTextNode("password");

        sm.writeTo(System.out);

        URL url = new URL("https://fgb-desktop:7071/service/admin/soap");
        
        SOAPMessage response = connection.call(sm, url);
        System.out.println(response.getContentDescription());
        return sm;
Thanks
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.