Results 1 to 7 of 7

Thread: ChangePasswordRequest

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

    Default ChangePasswordRequest

    when I install zcs-3.0.0_M3_436.RHEL4 on RHEL4. I write a java code like this:
    Code:
    import java.io.FileInputStream;
    import javax.xml.soap.MessageFactory;
    import javax.xml.soap.SOAPConnection;
    import javax.xml.soap.SOAPConnectionFactory;
    import javax.xml.soap.SOAPMessage;
    import javax.xml.soap.SOAPPart;
    import javax.xml.transform.Source;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.stream.StreamResult;
    import javax.xml.transform.stream.StreamSource;
    public class soap
    	{
    	 public static void main(String args[]){
    	  
    	 try{	
    		SOAPConnectionFactory  soapConnFactroy=SOAPConnectionFactory.newInstance();
    		SOAPConnection connection=soapConnFactroy.createConnection();
    		MessageFactory messageFactory=MessageFactory.newInstance();
    		SOAPMessage message=messageFactory.createMessage();
    		SOAPPart soapPart =message.getSOAPPart();
    	StreamSource ss = new StreamSource(new FileInputStream("soap.msg"));
         soapPart.setContent(ss);
         message.saveChanges();
         System.out.println("\nRequest:\n");
         message.writeTo(System.out);
         System.out.println();
         String ulr=
         	"http://192.168.1.168:80/service/soap";
         SOAPMessage reply=connection.call(message,ulr);
         System.out.println("\nRESPONSE:\n");
         TransformerFactory transformerFactory = 
             TransformerFactory.newInstance();
         Transformer transformer = 
          transformerFactory.newTransformer();
         Source sourceContent = reply.getSOAPPart().getContent();
         StreamResult result = new StreamResult(System.out);
         transformer.transform(sourceContent, result);
         System.out.println();
         connection.close();
         }catch(Exception e)
    		{
    			System.out.println(e.getMessage());
    		}
    	}
    	
    }
    the soap.msg like this:
    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Body>
    <ChangePasswordRequest xmlns="urn:zimbraAccount">
    <account by="name">cross@cross.com</account>
    <oldPassword>zimbra</oldPassword>
    <password>cross</password>
    </ChangePasswordRequest>
    </soap:Body>
    </soap:Envelope> ii's was success to chang the password.
    but when I install the last release zcs-3.0.1_GA_160.RHEL4.tgz
    I run the code like before but it's display error like this :
    com.sun.xml.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?
    2006-3-25 15:51:27 com.sun.xml.messaging.saaj.soap.MessageImpl identifyContentType
    严重: SAAJ0537: Invalid Content-Type. Could be an error message instead of a SOAP message
    I just know it's was error at the soap xmlStream anybody can tell me what'error?
    thank you !
    Last edited by KevinH; 03-25-2006 at 09:08 AM.

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

    Default

    What version did you have before?
    Looking for new beta users -> Co-Founder of Acompli. Previously worked at Zimbra (and Yahoo! & VMware) since 2005.

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

    Default zcs-3.0.0_M3_436.RHEL4.tgz

    I just use this version
    I changepassword was success

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

    Default changepassword

    just anybody can give me a example how to changepassword by soap
    what's the right xmlStream !!!!!

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

    Default

    It's easier to just get these from the application. Run it with ?debug=3. This will open a widow and give you the XML to send for each request.
    Looking for new beta users -> Co-Founder of Acompli. Previously worked at Zimbra (and Yahoo! & VMware) since 2005.

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

    Default thank you for answer question

    I try it I get the soap xmlStream.
    But I try it by java code like this:
    import java.io.FileInputStream;
    import javax.xml.soap.MessageFactory;
    import javax.xml.soap.SOAPConnection;
    import javax.xml.soap.SOAPConnectionFactory;
    import javax.xml.soap.SOAPMessage;
    import javax.xml.soap.SOAPPart;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.Source;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.stream.StreamResult;
    import javax.xml.transform.stream.StreamSource;
    public class soap
    {
    public static void main(String args[]){

    try{
    SOAPConnectionFactory soapConnFactroy=SOAPConnectionFactory.newInstance( );
    SOAPConnection connection=soapConnFactroy.createConnection();
    MessageFactory messageFactory=MessageFactory.newInstance();
    SOAPMessage message=messageFactory.createMessage();
    SOAPPart soapPart =message.getSOAPPart();
    StreamSource ss = new StreamSource(new FileInputStream("xml.msg"));
    soapPart.setContent(ss);
    message.saveChanges();
    System.out.println("\nRequest:\n");
    message.writeTo(System.out);
    System.out.println();
    String ulr="http://192.168.1.124:80/service/soap";
    SOAPMessage reply=connection.call(message,ulr);
    System.out.println("\nRESPONSE:\n");
    TransformerFactory transformerFactory =
    TransformerFactory.newInstance();
    Transformer transformer =
    transformerFactory.newTransformer();
    Source sourceContent = reply.getSOAPPart().getContent();
    StreamResult result = new StreamResult(System.out);
    transformer.transform(sourceContent, result);
    System.out.println();
    connection.close();
    }catch(Exception e)
    {
    System.out.println(e.getMessage());
    }
    }
    }
    the xml.msg like this :
    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Header>
    <context xmlns="urn:zimbra">
    <nosession/>
    <format type="js"/>
    </context>
    </soap:Header>
    <soap:Body>
    <AuthRequest xmlns="urn:zimbraAccount">
    <account by="name">
    cross@sina.cn
    </account>
    <password>
    chenjin
    </password>
    </AuthRequest>
    </soap:Body>
    </soap:Envelope>

    it's also error like this:
    java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?
    2006-3-28 16:29:24 com.sun.xml.messaging.saaj.soap.MessageImpl identifyContentType
    SAAJ0537: Invalid Content-Type. Could be an error message instead of a SOAP message
    I look the Debug :
    Async RPC request: Add header Content-Type - application/soap+xml; charset=utf-8
    so I think I was error at the but I don't know how to deal with it.
    Last edited by crossany; 07-05-2010 at 12:37 AM.

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

    Default

    What is the full stack trace? Which line are you getting the error on?
    Looking for new beta users -> Co-Founder of Acompli. Previously worked at Zimbra (and Yahoo! & VMware) since 2005.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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