Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Hi,
It could be a bug in cxf's @WebServiceProvider implementation that we cannot control the output xml encoding by setting SOAPMessage.CHARACTER_SET_ENCODING. The encoding (
) response message was not changed when I change CHARACTER_SET_ENCODING to UTF-16.<?xml version="1.0" encoding="UTF-8"?>
Please see my test class:
@WebServiceProvider
@ServiceMode(value = Service.Mode.MESSAGE)
public class CalculatorProvider implements Provider<SOAPMessage> {@Override
public SOAPMessage invoke(SOAPMessage request) {long start = System.currentTimeMillis();
System.out.println("********* start at " + start);
tryUnknown macro: { MessageFactory mf = MessageFactory.newInstance(); SOAPMessage soapMsg = mf.createMessage(); soapMsg.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, "UTF-16"); soapMsg.setProperty(SOAPMessage.WRITE_XML_DECLARATION, "false"); soapMsg.getSOAPBody().addBodyElement(new QName("mytest")); soapMsg.saveChanges(); return soapMsg; }catch (SOAPException e)
Unknown macro: { throw new RuntimeException(e); }}
public static void main(String[] args)
Unknown macro: { System.out.println("Starting Server"); CalculatorProvider implementor = new CalculatorProvider(); String address = "http}}