I have a soap client which call a SOAP WS method. Issue is, when I receive data in JAVA using below code, java parses SOAPMessage using some default encoding. As a result when I print WS response I see some garbage characters.
SOAPConnectionFactory connectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection connection = connectionFactory.createConnection();
SOAPMessage response = connection.call(soapMessage, endpoint);
So, is there any way, by which I can specify or force .call() method above to use a particular character encoding.
I have tested WS using SOAP UI and RAW XML tab of SOAP UI shows valid characters.
Edit: Am printing and validating presence of garbage characters using below code:
ByteArrayOutputStream baos = new ByteArrayOutputStream();
response.writeTo(baos);
String s2 = new String(baos.toByteArray(), "ISO-8859-1"); // decoding
System.out.println(s2);