[jboss-user] [JBossWS] - Charset encoding problem from Linux to Windows with Dispatch
cavani
do-not-reply at jboss.com
Tue Apr 1 11:11:15 EDT 2008
Hi,
I am using JBossWS Native for client code implementation in a set of Eclipse plugins. At first, I used WSDL2Java approach to generate client code - this works fine with WS-Security and all. But now, I need take advantage of BIRT's WS/XML ODA driver (that uses something like XPath to map XML as tables).
So, I converted all generated code to Dispatch approach with StreamSource. My first problem was with WS-Security with Dispatch not decrypting response. This was fixed with 2.0.4, and works perfectly when server and client are on Linux machines. But when I ran the client on a Windows XP, no accent character is read, but the message are decrypted.
The server is an unmodified AS 4.2.2 (running on linux). Java 5 (13 for linux, 15 for windows bundled together).
I start digging into JBossWS code but could not find an fix yet.
My code (it work fine on linux-linux):
| QName serviceName = new QName("http://tlon.com.br", local);
| QName portName = new QName("http://tlon.com.br", local + "Port");
|
| Service service = Service.create(wsdlLocation, serviceName);
|
| Dispatch<StreamSource> dispatch = service.createDispatch(portName, StreamSource.class, Mode.MESSAGE);
|
| Map<String, Object> reqContext = dispatch.getRequestContext();
| reqContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointAddress);
| reqContext.put(BindingProvider.USERNAME_PROPERTY, username);
| reqContext.put(BindingProvider.PASSWORD_PROPERTY, "");
|
| ConfigProvider config = (ConfigProvider) dispatch;
| config.setSecurityConfig(DispatchFactory.class.getClassLoader().getResource("META-INF/jboss-wsse-client.xml").toExternalForm());
| config.setConfigName("Standard WSSecurity Client");
|
| Reader requestReader = new StringReader(requestMessage);
| StreamSource request = new StreamSource(requestReader);
| StreamSource response = dispatch.invoke(request);
| requestReader.close();
| Reader responseReader = response.getReader();
| StringWriter responseWriter = new StringWriter();
| char[] buffer = new char[1024];
| int read = -1;
| while ((read = responseReader.read(buffer)) != -1)
| responseWriter.write(buffer, 0, read);
| responseReader.close();
| return responseWriter.toString();
|
If someone has a good clue, please let me know... if I find a fix I will report here.
Thanks,
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4140575#4140575
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4140575
More information about the jboss-user
mailing list