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-24-2006, 11:59 PM
Senior Member
 
Posts: 59
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 08:08 AM..
Reply With Quote
  #2 (permalink)  
Old 03-25-2006, 08:21 AM
Zimbra Employee
 
Posts: 4,792
Default

What version did you have before?
__________________
Bugzilla - Wiki - Downloads - Offline Client
Reply With Quote
  #3 (permalink)  
Old 03-25-2006, 11:35 PM
Senior Member
 
Posts: 59
Default zcs-3.0.0_M3_436.RHEL4.tgz

I just use this version
I changepassword was success
Reply With Quote
  #4 (permalink)  
Old 03-27-2006, 06:32 PM
Senior Member
 
Posts: 59
Default changepassword

just anybody can give me a example how to changepassword by soap
what's the right xmlStream !!!!!
Reply With Quote
  #5 (permalink)  
Old 03-27-2006, 06:36 PM
Zimbra Employee
 
Posts: 4,792
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.
__________________
Bugzilla - Wiki - Downloads - Offline Client
Reply With Quote
  #6 (permalink)  
Old 03-28-2006, 12:41 AM
Senior Member
 
Posts: 59
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..
Reply With Quote
  #7 (permalink)  
Old 03-28-2006, 07:43 AM
Zimbra Employee
 
Posts: 4,792
Default

What is the full stack trace? Which line are you getting the error on?
__________________
Bugzilla - Wiki - Downloads - Offline Client
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


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.