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

Additional namespace is added when web service provider implements Provider<DOMSource>

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.6.2
    • 2.5.7, 2.6.4, 2.7.1
    • None
    • None
    • win7 + oracle jdk 1.6.0_29-b11

    • Unknown

    Description

      In the invoke method of web service provider which implements Provider<DOMSource>, using the following code to return a response DOMSource,

      DOMSource response = new DOMSource();
      DocumentBuilderFactory documentFacory = DocumentBuilderFactory.newInstance();
      DocumentBuilder documentBuilder = null;
      try

      { documentBuilder = documentFacory.newDocumentBuilder(); }

      catch (ParserConfigurationException e)

      { throw new RuntimeException(e); }

      Document doc;
      try

      { doc = documentBuilder.parse(new InputSource( new ByteArrayInputStream(message.getBytes("UTF-8")))); }

      catch (Exception e)

      { throw new RuntimeException("error parse: " + str, e); }

      response.setNode(doc);

      In above code, if message string is:

      "<ns2:echoResponse xmlns:ns2="annotations.webserviceprovider.fq"><return>Hello world</return></ns2:echoResponse>",

      but the soapMessage body will be:

      "<ns2:echoResponse xmlns:ns2="annotations.webserviceprovider.fq" xmlns="annotations.webserviceprovider.fq"><return>Hello world</return></ns2:echoResponse>"

      Additional attribute xmlns="annotations.webserviceprovider.fq" is added by cxf. This additional attribute causes the unmarshal issue at client side.

      Attachments

        1. W3CDOMStreamReader.java.patch
          1 kB
          Hong Fang Han

        Activity

          People

            ffang Freeman Yue Fang
            hanhongfang Hong Fang Han
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: