Zimbra SOAP API - java?

I need to use the Zimbra Soap API for the new feature we're working on. However, I could not find many examples of Java clients using this API, and in general I lost a bit of what I need to learn. (I'm new to using SoAP in general)

Basically, I will need to send the username and get some kind of zimbra identifier for the user, change the user information using my java code and then return this data to the server.

I found the wsdl files for this on the server, but I'm not sure where to go from here. Any help will be appreciated - everything from high-level explanations to examples to detailed steps.

Thanks in advance!

+6
source share
2 answers

Unfortunately, the Zimbra SOAP API is not really SOAP. This is basically XML-over-HTTP. Therefore, you will have to manually create the xml documents that you submit to zimbra.

I don't know about the Java library for this, I made Python one .

+5
source

ENDPOINT: https: //your.domain.for.zimbra/service/soap/GetIdentitiesRequest

SOAP PERMISSION

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> <soap:Header> <context xmlns="urn:zimbra"> <format type="xml"/> <csrfToken>????????</csrfToken> </context> </soap:Header> <soap:Body> <GetIdentitiesRequest xmlns="urn:zimbraAccount"> <authToken>??????</authToken> </GetIdentitiesRequest> </soap:Body> </soap:Envelope> 

csrfToken your answer in js window.csrfToken
you give authToken in cooke ZM_AUTH_TOKEN

Soap requests should send cookies ZM_AUTH_TOKEN , JSESSIONID and ZM_TEST

Jetty Client API Code

 ContentResponse contentResponse = client.POST(endpoint) .content(new StringContentProvider("XML envelope")) .cookie(new HttpCookie("JSESSIONID", jSessionIdCookieValue)) .cookie(new HttpCookie("ZM_AUTH_TOKEN", authToken)) .cookie(new HttpCookie("ZM_TEST", "true")) .send(); 

In addition, there are many endpoints.

 https://your.domain.for.zimbra/service/soap/GetInfoRequest https://your.domain.for.zimbra/service/soap/GetRightsRequest https://your.domain.for.zimbra/service/soap/CheckRightsRequest 

The envelope changes only in the child of each endpoint

 <GetIdentitiesRequest> <GetInfoRequest> <GetRightsRequest> <CheckRightsRequest> 
0
source

Source: https://habr.com/ru/post/973838/


All Articles