Hello,
I have a problem with UTF-8 encoding in my web service. Web service send its request to external system like a SOAPMessage. The request message is in UTF-8 encoding. When it reaches the client, some letters are not shown.
This is my Endpoint:
The class responsible for SOAPMessage sending is :Code:package com.medicum.tns.ws; import org.jdom.Element; import org.jdom.JDOMException; import org.springframework.ws.server.endpoint.AbstractJDomPayloadEndpoint; import com.medicum.tns.service.MessageRouter; public class EhealthEndpoint extends AbstractJDomPayloadEndpoint { private MessageRouter messageRouter; public EhealthEndpoint(MessageRouter messageRouter) throws JDOMException { this.messageRouter = messageRouter; } @Override protected Element invokeInternal(Element request) throws Exception{ return messageRouter.routeMessage(request); } }
When I try to print response message in consolesome letters are not printed. Printing code:Code:package com.medicum.tns.transport; import java.io.IOException; import javax.xml.soap.SOAPConnection; import javax.xml.soap.SOAPConnectionFactory; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage; import com.medicum.tns.object_const.XRoadServiceConst; public class EHealthSOAPMsgTransporterImpl implements SOAPMsgTransporter { @Override public SOAPMessage send(SOAPMessage msg) throws IOException { SOAPMessage response = null; try { SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance(); SOAPConnection connection = factory.createConnection(); response = connection.call(msg, XRoadServiceConst.securityServerIP); connection.close(); } catch (SOAPException se) { response = null; } return response; } }
Can you help with this problem and is there some way to see wich encoding is actually used in string?Code:public static void out(SOAPMessage src) throws SOAPException, IOException { PrintStream out = new PrintStream(System.out, true, "UTF-8"); src.writeTo(out); }


Reply With Quote