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 08-26-2010, 03:07 PM
Intermediate Member
 
Posts: 17
Default Sending SOAP message and receiving JSON

I can successfully send a SOAP message over a java client and get the response. Now let's say I need to receive a JSON response, what would be the approach?

My client looks like this:
Code:
SOAPConnection soapConnection = SOAPConnectionFactory.newInstance().createConnection();
        MessageFactory messageFactory = MessageFactory.newInstance();

        // Create a message from the message factory.
        SOAPMessage soapMessage = messageFactory.createMessage();

       //build soap message and add format attribute and set it to JS in the message
        soapMessage.saveChanges();
        URLEndpoint endpoint = new URLEndpoint("https://zimbra-box:7071/service/admin/soap");
         
        SOAPMessage reply = soapConnection.call(soapMessage, endpoint);

        //Modify this part to return a JSON string
Any hints or suggestions?
Reply With Quote
  #2 (permalink)  
Old 09-04-2010, 09:22 AM
be1 be1 is offline
Junior Member
 
Posts: 6
Default

Quote:
Originally Posted by fmatar View Post
I can successfully send a SOAP message over a java client and get the response. Now let's say I need to receive a JSON response, what would be the approach?
...
Any hints or suggestions?
you have to put a 'format' element in the SOAP header part, such as the XML results in:

<soap:Envelope ...>
<soap:Header>
...
<format type='js' />
</soap:Header>
...
</soap:Envelope>
Reply With Quote
  #3 (permalink)  
Old 09-04-2010, 02:47 PM
Intermediate Member
 
Posts: 17
Default

No that doesn't work, you can't receive a JSON string as SOAP message
Reply With Quote
  #4 (permalink)  
Old 09-04-2010, 05:24 PM
be1 be1 is offline
Junior Member
 
Posts: 6
Default

Quote:
Originally Posted by fmatar View Post
No that doesn't work, you can't receive a JSON string as SOAP message
Uh... maybe i do not use the same zimbra version, but mine has JSON replies (when i ask for it)
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.