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