I already installed zcs-5.0.7_GA_2450.UBUNTU8.FRANKLIN.
Now I can happily try the ZClient
I a bit confuse is this tutorial still works/valid?
ZClient - Zimbra :: Wiki
I using the ZimbraStore.jar file as inside the zcs-5.0.7_GA_2450.UBUNTU8.FRANKLIN.
I use NetBean to run... Before I want to run the code, Some warning line came out... Which some static variable not declare in the AccountService class such as AccountService.E_ACCOUNT, ...
Code:
import java.io.IOException;
import com.zimbra.common.service.ServiceException;
import com.zimbra.common.soap.Element;
import com.zimbra.common.soap.SoapHttpTransport;
import com.zimbra.cs.service.mail.MailService;
import com.zimbra.cs.service.account.AccountService;
import com.zimbra.cs.servlet.ZimbraServlet;
import com.zimbra.cs.util.Zimbra;
import com.zimbra.soap.ZimbraSoapContext;
public class TestZClient {
public static void main(String [] args)
{
SoapHttpTransport trans = null;
try {
String URI = "https://3.244.4.16/zimbraAdmin/server/soap/iirc";
trans = new SoapHttpTransport( URI);
Element request = Element.XMLElement.mFactory.createElement(AccountService.AUTH_REQUEST);
request.addAttribute(AccountService.E_ACCOUNT, "userdoesntexist@technicaldetails.org", Element.DISP_CONTENT);
request.addAttribute(AccountService.E_PASSWORD, "notapassword", Element.DISP_CONTENT);
Element response = trans.invoke(request);
// get the auth token out, no default, must be present or a service exception is thrown
String authToken = response.getAttribute(AccountService.E_AUTH_TOKEN);
// get the session id, if not present, default to null
String sessionId = response.getAttribute(ZimbraSoapContext.E_SESSION_ID, null);
// set the auth token and session id in the transport for future requests to use
trans.setAuthToken(authToken);
if (sessionId != null)
trans.setSessionId(sessionId);
Element tagsRequest = Element.XMLElement.mFactory.createElement(MailService.GET_TAG_REQUEST);
Element tagsResponse = trans.invoke(tagsRequest);
System.out.println(tagsResponse.prettyPrint());
}
catch (Exception e){
e.printStackTrace();
}
}
} May I know the tutorial still valid or not?
If not valid anymore can you direct me to the valid Zimbra SOAP tutorial....?
Thank you
-fsloke