Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-170

AxiomSoapMessageFactory + PayloadRootAnnotationMethodEndpointMapping allways falls to DOM parsing

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: 1.0.1
    • Component/s: Core
    • Labels:
      None

      Description

      DOM transformation is used every time in org.springframework.ws.server.endpoint.support.PayloadRootUtils#getPayloadRootQName because the root event type is XMLStreamConstants.START_DOCUMENT

      Proposed improvement: (working with Woodstox 3.2.1.jar and sjsxp 1.0.1)

      public static QName getPayloadRootQName(Source source, TransformerFactory transformerFactory)
      throws TransformerException, XMLStreamException {
      if (source instanceof DOMSource) {
      DOMSource domSource = (DOMSource) source;
      Node node = domSource.getNode();
      if (node.getNodeType() == Node.ELEMENT_NODE)

      { return QNameUtils.getQNameForNode(node); }

      else if (node.getNodeType() == Node.DOCUMENT_NODE)

      { Document document = (Document) node; return QNameUtils.getQNameForNode(document.getDocumentElement()); }

      }
      else if (source instanceof StaxSource) {
      StaxSource staxSource = (StaxSource) source;
      if (staxSource.getXMLStreamReader() != null) {
      XMLStreamReader streamReader = staxSource.getXMLStreamReader();
      if (streamReader.getEventType() == XMLStreamConstants.START_ELEMENT ||
      streamReader.getEventType() == XMLStreamConstants.END_ELEMENT)

      { return streamReader.getName(); }

      else if(streamReader.getEventType() == XMLStreamConstants.START_DOCUMENT) {
      streamReader.next();
      if(streamReader.getEventType() == XMLStreamConstants.START_ELEMENT ||
      streamReader.getEventType() == XMLStreamConstants.END_ELEMENT)

      { return streamReader.getName(); }

      }
      }
      }
      // we have no other option than to transform
      Transformer transformer = transformerFactory.newTransformer();
      DOMResult domResult = new DOMResult();
      transformer.transform(source, domResult);
      Document document = (Document) domResult.getNode();
      return QNameUtils.getQNameForNode(document.getDocumentElement());
      }

        Activity

        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        Fixed. Thanks for the resolution!

        Show
        arjen.poutsma Arjen Poutsma added a comment - Fixed. Thanks for the resolution!
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        Closing 1.0.1 issues.

        Show
        arjen.poutsma Arjen Poutsma added a comment - Closing 1.0.1 issues.

          People

          • Assignee:
            arjen.poutsma Arjen Poutsma
            Reporter:
            anthavio Martin Vanek
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: