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 03-19-2006, 08:11 PM
Senior Member
 
Posts: 59
Default soap CreateAccountRequest code

I just try to send a soap request like this:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>
<context xmlns="urn:zimbra">
<authToken>admin@cross.com</authToken>
</context>
</soap:Header>
<soap:Body>
<CreateAccountRequest xmlns="urn:zimbraAdmin">
<name>rush@cross.com</name>
<password>zimbra</password>
</CreateAccountRequest>
</soap:Body>
</soap:Envelope>
but I failure who can tell me the right code thank you !
Reply With Quote
  #2 (permalink)  
Old 03-19-2006, 09:03 PM
sam sam is offline
Zimbra Employee
 
Posts: 821
Default

The auth token is incorrect. It needs to be what was returned by the server in a previous AuthRequest.
__________________
Sam Khavari

:: :: [ Zimbra ] :: :: [ Bugzilla ] :: :: [ Product Portal ] :: :: [ Wiki ] :: :: [ Downloads ] :: :: [ . ] ::
Reply With Quote
  #3 (permalink)  
Old 03-20-2006, 08:02 PM
Senior Member
 
Posts: 59
Default could you give me a example

I don't konw what your mean
could you give me a example thank you
Reply With Quote
  #4 (permalink)  
Old 03-20-2006, 08:22 PM
sam sam is offline
Zimbra Employee
 
Posts: 821
Default

yeah, first send

<Envelope xmlns="http://www.w3.org/2003/05/soap-envelope">
<Body>
<AuthRequest xmlns="urn:zimbraAccount">
<account by="name">user1</account>
<password>****</password>
</AuthRequest>
</Body>
</Envelope>

you'll get back

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>...stuff...
</soap:Header>
<soap:Body>
<AuthResponse xmlns="urn:zimbraAccount">
<authToken>...auth_token...</authToken>
<lifetime>172800000</lifetime>
<sessionId id="55">55</sessionId>
</AuthResponse>
</soap:Body>
</soap:Envelope>


You must save the auth_token and sessionId and pass it back to the server in subsequent requests.
__________________
Sam Khavari

:: :: [ Zimbra ] :: :: [ Bugzilla ] :: :: [ Product Portal ] :: :: [ Wiki ] :: :: [ Downloads ] :: :: [ . ] ::
Reply With Quote
  #5 (permalink)  
Old 03-21-2006, 02:51 AM
Senior Member
 
Posts: 59
Default it's doesn't reply soap Response

I write a Java code like this :
public class NoCertificationHttpsGetSample {
public static void main(String[] args) {
Protocol myhttps = new Protocol("https",
new MySecureProtocolSocketFactory(),7071);
Protocol.registerProtocol("https", myhttps);
HttpClient httpClient = new HttpClient();
httpClient.getHostConfiguration().setHost("192.168 .1.127",7071,myhttps);
String url="https://192.168.1.127:7071/service/admin/soap";
PostMethod postMethod = new PostMethod(url);
postMethod.getParams().setParameter(HttpMethodPara ms.RETRY_HANDLER,
new DefaultHttpMethodRetryHandler());
try{
InputStream soap= new FileInputStream("soap.xml");
postMethod.setRequestBody(soap);
}catch(Exception err){};
try{
int statusCode = httpClient.executeMethod(postMethod);
if (statusCode != HttpStatus.SC_OK) {
System.err.println("Method failed: "+ postMethod.getStatusLine());
}
byte[] responseBody = postMethod.getResponseBody();
System.out.println(new String(responseBody));
} catch (HttpException e) {
System.out.println("Please check your provided https address!");
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally{
postMethod.releaseConnection();
}

}
}
soap.xml like this :
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body>
<AuthRequest xmlns="urn:zimbraAdmin">
<name>admin@sina.com</name>
<password>zimbra</password>
</AuthRequest>
</soap:Body>
</soap:Envelope>

this Error like this :

Method failed: HTTP/1.1 500 Internal Server Error
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Body><soap:Fault><soap:Code><soap: Value>soap:Receiver</soap:Value></soap:Code><soap:Reason><soap:Text>system failure: Request not allowed on port 443</soap:Text></soap:Reason><soapetail><Error xmlns="urn:zimbra"><Code>service.FAILURE</Code><Trace>com.zimbra.cs.service.ServiceException : system failure: Request not allowed on port 443
at com.zimbra.cs.service.ServiceException.FAILURE(Ser viceException.java:99)
at com.zimbra.cs.servlet.ZimbraServlet.service(Zimbra Servlet.java:136)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:107)
at org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:526)
at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:825)
at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:738)
at org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThr ead.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
</Trace></Error></soapetail></soap:Fault></soap:Body></soap:Envelope>

anybody can tell me why
I crazy !

Last edited by crossany; 07-05-2010 at 01:39 AM..
Reply With Quote
  #6 (permalink)  
Old 03-21-2006, 07:30 AM
Zimbra Employee
 
Posts: 4,792
Default

Are you sure your using the API correctly? Seems the request is going to 443 and not 7071.
__________________
Bugzilla - Wiki - Downloads - Offline Client
Reply With Quote
  #7 (permalink)  
Old 03-21-2006, 06:50 PM
Senior Member
 
Posts: 59
Default I know the port error

I know the port error but if I getMethod from "https://192.168.1.127:7071"
the will response the HTML code so I think it's will be the soap was wrong
Reply With Quote
  #8 (permalink)  
Old 03-21-2006, 08:04 PM
Zimbra Employee
 
Posts: 4,792
Default

The SOAP url is:

https://192.168.1.127:7071/service/admin/soap

or

https://192.168.1.127/service/soap for user level calls.
__________________
Bugzilla - Wiki - Downloads - Offline Client
Reply With Quote
  #9 (permalink)  
Old 03-21-2006, 09:38 PM
Senior Member
 
Posts: 59
Default String url="https://192.168.1.127:7071/service/admin/soap";

I set the URL ="https://192.168.1.127:7071/service/admin/soap" in the java code before but it's also error
Reply With Quote
  #10 (permalink)  
Old 03-21-2006, 09:47 PM
sam sam is offline
Zimbra Employee
 
Posts: 821
Default

are you able to login to the admin console? https://<your-server>:7071/zimbraAdmin ?
__________________
Sam Khavari

:: :: [ Zimbra ] :: :: [ Bugzilla ] :: :: [ Product Portal ] :: :: [ Wiki ] :: :: [ Downloads ] :: :: [ . ] ::
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.