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

Getting the wsdl from a cxf webservice with custom XMLOuputFactory throws an exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.1.8, 3.0.11, 3.2.0
    • None
    • None
    • Novice

    Description

      I defined a service endpoint with a custom XmlOutputFactory

      <jaxws:endpoint id="myWebService" implementorClass="a.b.c.MyService"
              implementor="#Mybean" address="/myService">
              <jaxws:properties>
                  <entry key="javax.xml.XMLOutputFactory">
                      <ref bean="invalidCharacterReplacingXmlOutputFactory"/>
                  </entry>
              </jaxws:properties>
      </jaxws:endpoint>
      

      When Using the WSDLGetOutInterceptor, I get the following error;
      Can not output XML declaration, after other output has already been done.
      The StaxOutputInterceptor sets the flag FORCE_START_DOCUMENT to true when using a custom xmlOutputFacory, then writes the prolog. The WSDLGetOutInterceptor writes it again and throws the exception.

      This was supposed to be fixed with commit 25f0eb7f955a84baf6c3b634ff316cb831a2acfa, with version 3.3 if I'm correct(changed class: WSDLGetOutInterceptor, commit message: Write the prolog only if it hasn't already been written). But I think the change is not correct:

      -            StaxUtils.writeNode(doc, writer, true);
      +            StaxUtils.writeDocument(doc, writer, true,
      +                                    !MessageUtils.getContextualBoolean(message, 
      +                                                                       StaxOutInterceptor.FORCE_START_DOCUMENT, 
      +                                                                       false));
      

      Knowing that the signature of StaxUtils.writeDocument is:

      public static void writeDocument(Document d, XMLStreamWriter writer, boolean writeProlog,  boolean repairing)
      

      That means that the boolean reparing depends on the flag FORCE_START_DOCUMENT from version 3.3, whereas the boolean writeProlog is always true ! To me, it seems like the two parameters have been swapped.

      Attachments

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            guillaume.pansier Guillaume Pansier
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: