[jboss-user] [JBossWS] - Re: Charset encoding problem from Linux to Windows with Disp

cavani do-not-reply at jboss.com
Fri Apr 4 08:40:38 EDT 2008


There is something that I am not figuring out. Some characters just are misinterpreted... anyway... I change to SOAPMessage and set the default encoding to UTF-8 (from windows-1252 on Windows)... now it really works!

for JVM:-Dfile.encoding=UTF-8


  | 	private Dispatch<SOAPMessage> dispatch;
  | 
  | 	private MessageFactory messageFactory;
  | 
  | 	/* package */ DispatchHandler(Dispatch<SOAPMessage> dispatch) throws Exception
  | 	{
  | 		this.dispatch = dispatch;
  | 
  | 		messageFactory = MessageFactory.newInstance();
  | 	}
  | 
  | 	public SOAPMessage createRequest(String request) throws Exception
  | 	{
  | 		ByteArrayInputStream stream = new ByteArrayInputStream(request.getBytes());
  | 		SOAPMessage message = messageFactory.createMessage(null, stream);
  | 		stream.close();
  | 		return message;
  | 	}
  | 
  | 	public String createResponse(SOAPMessage message) throws Exception
  | 	{
  | 		ByteArrayOutputStream stream = new ByteArrayOutputStream(1024);
  | 		message.writeTo(stream);
  | 		String response = stream.toString();
  | 		stream.close();
  | 		return response;
  | 	}
  | 
  | 	public String invoke(String request) throws Exception
  | 	{
  | 		try
  | 		{
  | 			SOAPMessage requestMessage = createRequest(request);
  | 
  | 			SOAPMessage responseMessage = dispatch.invoke(requestMessage);
  | 
  | 			return createResponse(responseMessage);
  | 	}
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4141630#4141630

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4141630



More information about the jboss-user mailing list