Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: soap CreateAccountRequest code

  1. #11
    crossany is offline Senior Member
    Join Date
    Mar 2006
    Posts
    59
    Rep Power
    9

    Default url="https://192.168.1.127:7071/zimbraAdmin"

    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/zimbraAdmin";
    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());
    }
    InputStream responseBody=postMethod.getResponseBodyAsStream();
    System.out.println(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:Header>
    <context xmlns="urn:zimbra"/>
    </soap:Header>
    <soap:Body>
    <AuthRequest xmlns="urn:zimbraAdmin">
    <name>admin@sina.com</name>
    <password>zimbra</password>
    </AuthRequest>
    </soap:Body>
    </soap:Envelope>


    error:
    2006-3-23 13:21:06 org.apache.commons.httpclient.HttpMethodDirector isRedirectNeeded
    信息: Redirect requested but followRedirects is disabled
    Method failed: HTTP/1.1 302 Moved Temporarily
    org.apache.commons.httpclient.AutoCloseInputStream @1cde100
    Last edited by crossany; 07-05-2010 at 12:38 AM.

  2. #12
    crossany is offline Senior Member
    Join Date
    Mar 2006
    Posts
    59
    Rep Power
    9

    Default String url="https://192.168.1.127:7071/auth/";

    I change the postMoethod url to "https://192.168.1.127:7071/auth/";
    the error like this :
    Method failed: HTTP/1.1 400 Bad Request
    org.apache.commons.httpclient.AutoCloseInputStream @2bbd86
    I think that should be the soap error
    would tell me the right soap xmlstream

  3. #13
    KevinH's Avatar
    KevinH is offline Expert Member
    Join Date
    Aug 2005
    Location
    San Mateo, CA
    Posts
    4,789
    Rep Power
    18

    Default

    Quote Originally Posted by crossany
    I change the postMoethod url to "https://192.168.1.127:7071/auth/";
    the error like this :
    Method failed: HTTP/1.1 400 Bad Request
    org.apache.commons.httpclient.AutoCloseInputStream @2bbd86
    I think that should be the soap error
    would tell me the right soap xmlstream
    That is a HTTP url for the webclient. It's not used for SOAP requests.
    Looking for new beta users -> Co-Founder of Acompli. Previously worked at Zimbra (and Yahoo! & VMware) since 2005.

  4. #14
    crossany is offline Senior Member
    Join Date
    Mar 2006
    Posts
    59
    Rep Power
    9

    Default admin AuthRequest

    Quote Originally Posted by sam
    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.
    I look the soap.txt and soapadmin.txt I find you tell me the code is was the user AuthRequest .I want send a AuthRequest as a admin . could you tell the
    soap xmlStream ,and tell the https url.

  5. #15
    fsloke is offline Loyal Member
    Join Date
    Jul 2008
    Posts
    91
    Rep Power
    7

    Default

    What is new MySecureProtocolSocketFactory() class do?

    Thank you

Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. XSD/WSDL Files for the SOAP Server?
    By photoadrian in forum Developers
    Replies: 5
    Last Post: 12-23-2012, 02:32 AM
  2. Postfix problem
    By jimbo in forum Administrators
    Replies: 46
    Last Post: 07-23-2007, 05:24 AM
  3. php CreateAccountRequest via SOAP
    By bookatechie in forum Developers
    Replies: 2
    Last Post: 05-02-2007, 11:28 AM
  4. 3.0 to 4.5.3 Upgrade failed (mysql error)
    By dealt in forum Installation
    Replies: 35
    Last Post: 03-19-2007, 10:30 PM
  5. Problem with SOAP CreateAccountRequest
    By rtanner in forum Administrators
    Replies: 1
    Last Post: 04-21-2006, 06:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •