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 11-08-2006, 07:38 AM
Junior Member
 
Posts: 5
Question How to consume zimbra SOAP API in my java application

Hi,

I am getting problem while trying to consume zimbra web service. The web services which I had consumed earlier, those were RPC style based soap oriented web services and for which I had been given a WSDL document reference URL, describing that web service. So I was able to generate the proxy stubs and classes in my programming framework, and therefore didn't have any problem.

Now since Zimbra web service is a document style web service (not RPC based), so it does not provide me a WSDL document reference URL, so I cannot generate stubs to simply use them. Now what I understand is that it should be a simple XML/SOAP document exchange based mechanism to send the request and get the response, while communicating to the document style based Zimbra web service.

I have been given the attached soap API documentation, which only tells me the request / response headers in XML format, but when I am the sending appropriate XML NODE to the given URL (mentioned below), I am getting an exception

"Server returned HTTP response code: 500 for URL: https://zimbra.vsnl.in:7071/service/admin/soap/"

URL: https://zimbra.vsnl.in:7071/service/admin/soap/

XML NODE:

<AuthRequest xmlns="urn:zimbraAdmin">

<name>admin@zimbra.vsnl.in</name>

<password>DummyPwd</password>

</AuthRequest>

I have tried with the following SOAP header as well, but still get the same error message

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">

<soap:Header>

<context xmlns="urn:zimbra"/>

</soap:Header>

<soap:Body>

<AuthRequest xmlns="urn:zimbraAdmin">

<name>admin@zimbra.vsnl.com</name>

<password>DummyPwd</password>

</AuthRequest>

</soap:Body>

</soap:Envelope>


The server is properly configured and admin control panel is accessible on browser on port 7071.

Can you help me understand, if there is some other way I need to pass the params to the given URL? If not then what would be the alternative solution. I tried to dig out in the source code also and it shows that the appropriate servlet "SoapServlet", listning on port 7071 takes the request as query string params only. Please help!!!!!

Regards,
Hemant Shrivastava
Reply With Quote
  #2 (permalink)  
Old 11-08-2006, 09:03 AM
sam sam is offline
Zimbra Employee
 
Posts: 821
Default

Here's a sample request sent by my app that works. You can compare it with yours and see whats different. What is in the body of the response sent by the server; it usually indicates what is wrong.

--Begin HTTP Request

POST /service/admin/soap/ HTTP/1.1
Content-Type: application/soap+xml; charset=utf-8
User-Agent: Test application
Host: localhost:7071
Content-Length: 308
Connection: Keep-Alive
Cache-Control: no-cache
Pragma: no-cache

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Header><context xmlns="urn:zimbra"><nonotify/><noqualify/></context></soap:Header><soap:Body><AuthRequest xmlns="urn:zimbraAdmin"><name>admin@ak.zimbra.com</name><password>test123</password></AuthRequest></soap:Body></soap:Envelope>
__________________
Sam Khavari

:: :: [ Zimbra ] :: :: [ Bugzilla ] :: :: [ Product Portal ] :: :: [ Wiki ] :: :: [ Downloads ] :: :: [ . ] ::
Reply With Quote
  #3 (permalink)  
Old 11-09-2006, 06:31 AM
Junior Member
 
Posts: 5
Question Re: How to consume zimbra SOAP API in my java application

HI Sam,

Thanks for your valuable input.

I have two further things to be clarified.

1). When I call admin soap api to create an account, if the inputs goes correct to it, it gives me correct result, but if any input goes wrong to it, or let say if i try to create an existing account, instead of giving me a failure SOAP response, it straight-away throws an internal server error with an exception code 500. I get the following error message

"Server returned HTTP response code: 500 for URL: https://zimbra.vsnl.in:7071/service/admin/"

This behavior i have observed with the domain creation soap API as well. Is it the default behavior in case a SOAP API execution is un-successfull.

2) I have the soap-admin.txt doc available with me from /opt/zimbra/doc

This document gives the basic inputs in XML format to the admin soap API's but doesn't provide me the SOAP format, corresponding to different types of request, such as modifying a user account, or such as modifying a domain , getting a specific user account attribute etc.

Is there any document availble which can provide me the SOAP format for making requests.

Thanks in advance,
Regards,
Hemant Shrivastava
Reply With Quote
  #4 (permalink)  
Old 11-09-2006, 12:27 PM
sam sam is offline
Zimbra Employee
 
Posts: 821
Default

the only documentation is whatever is in the ZimbraServer\docs directory. What is very helpful is to enable the debug logging in the admin console and see what requests it sends to the server.

1. Login to the admin console (https://server:7071/zimbraAdmin)
2. in the search box type '$set:debug 1' and hit enter
3. you'll see a dialog box popup that displays all the request/responses sent from the admin console

So if you wanted to see how to modify an account, you could modify the account using the admin console and see how it uses ModifyAccountRequest to apply the changes on the server.
__________________
Sam Khavari

:: :: [ Zimbra ] :: :: [ Bugzilla ] :: :: [ Product Portal ] :: :: [ Wiki ] :: :: [ Downloads ] :: :: [ . ] ::
Reply With Quote
  #5 (permalink)  
Old 11-09-2006, 11:32 PM
Junior Member
 
Posts: 5
Question

Hi Sam,

As per your instructions, i have set the debug mode to level 1 in the admin control panel, so a dialog popup appears as you said.

But when i modify the account using admin console, nothing appears in the debug window. The account is getting modified although. Only two buttons "Mark" & "Clear" on the left nav appears.

Is it some else where do i need to look into to enable the logging.

Regards,
Hemant Shrivastava
Reply With Quote
  #6 (permalink)  
Old 11-09-2006, 11:43 PM
sam sam is offline
Zimbra Employee
 
Posts: 821
Default

try going here:

https://server:7071/?mode=mjsf&gzip=false&debug=1

this should launch the debug window
__________________
Sam Khavari

:: :: [ Zimbra ] :: :: [ Bugzilla ] :: :: [ Product Portal ] :: :: [ Wiki ] :: :: [ Downloads ] :: :: [ . ] ::
Reply With Quote
  #7 (permalink)  
Old 11-15-2006, 08:00 AM
Junior Member
 
Posts: 5
Default Re: How to consume zimbra SOAP API in my java application

Thanks Sam,

I am able to get the SOAP headers in the debug window now.
Can you refer some existing open source soap client in JAVA, using which i can generate these SOAP headers.

I am right now using JDOM to parse the received SOAP responses....
Generating SOAP headers using JDOM is a cumborsome exercise.

Regards,
Hemant Shrivastava
Reply With Quote
  #8 (permalink)  
Old 11-15-2006, 08:38 AM
sam sam is offline
Zimbra Employee
 
Posts: 821
Default

The open source ZCS codebase has some code you might be interested in. Take a look at ZClient under ZimbraCommon. If that doesn't work:

http://www.google.com/search?q=java+soap
__________________
Sam Khavari

:: :: [ Zimbra ] :: :: [ Bugzilla ] :: :: [ Product Portal ] :: :: [ Wiki ] :: :: [ Downloads ] :: :: [ . ] ::
Reply With Quote
  #9 (permalink)  
Old 11-15-2006, 12:16 PM
sam sam is offline
Zimbra Employee
 
Posts: 821
Default

sorry, ZClient is under ZimbraServer:

http://zimbra.svn.sourceforge.net/vi...ra/cs/zclient/
__________________
Sam Khavari

:: :: [ Zimbra ] :: :: [ Bugzilla ] :: :: [ Product Portal ] :: :: [ Wiki ] :: :: [ Downloads ] :: :: [ . ] ::
Reply With Quote
  #10 (permalink)  
Old 11-26-2006, 10:46 PM
Junior Member
 
Posts: 5
Angry Re: How to consume zimbra SOAP API in my java application

Hi Sam,

When I get the user account details via SOAP API's, the value of userPassword attribute comes as blocked.

<a n="userPassword">VALUE-BLOCKED</a>

SO i cannot fetch the user password value, thru a SOAP API call.

Is there anyway i can disable the VALUE-BLOCKED fetaure of userPassword attribute.

This is important & urgent so kindly help me in knowing how can i fetch the user password.

Regards,
Hemant Shrivastava
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.