Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-3228

SOAPMessage does not recognize SOAPMessage.WRITE_XML_DECLARATION

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.3.2
    • JAX-WS Runtime
    • 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 (

      <?xml version="1.0" encoding="UTF-8"?>

      ) response message was not changed when I change CHARACTER_SET_ENCODING to UTF-16.

      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);
      try

      Unknown 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}

      }

      Attachments

        Activity

          People

            dkulp Daniel Kulp
            veaven David Liu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: