Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8159058

SAXParseException when sending soap message

    Details

    • Subcomponent:
    • Resolved In Build:
      b153
    • Verification:
      Verified

      Backports

        Description

        The SOAP message with empty default namespace (xmlns="") sent to WS can result in incorrect message received on WS handler side.

        SOAP message sent to WS:
        <?xml version="1.0" encoding="UTF-8"?>
        <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
        <s:Body>
            <SampleServiceRequest xmlns="http://test.example.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <RequestParams xmlns="">
                    <Param1>Param1_Value</Param1>
                    <Param2>Param2_Value</Param2>
                </RequestParams>
            </SampleServiceRequest>
        </s:Body>
        </s:Envelope>

        Message received on WS handler side:
        <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
        <SOAP-ENV:Header/>
        <s:Body>
            <SampleServiceRequest xmlns="http://test.example.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <RequestParams xmlns="http://test.example.com">
                    <Param1 xmlns="">Param1_Value</Param1>
                    <Param2 xmlns="">Param2_Value</Param2>
                </RequestParams>
            </SampleServiceRequest>
        </s:Body>
        </s:Envelope>

        The <RequestParams> has incorrect default namespace set: xmlns="http://test.example.com">, it should be xmlns="" instead.

        The incorrect message can cause SAXParseException during the validation of the received message:
        org.xml.sax.SAXParseException; cvc-complex-type.2.4.a: Invalid content was found starting with element 'RequestParams'. One of '{RequestParams}' is expected.
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:452)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3230)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1790)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:740)
        at com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.beginNode(DOMValidatorHelper.java:277)
        at com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(DOMValidatorHelper.java:244)
        at com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(DOMValidatorHelper.java:190)
        at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:109)
        at javax.xml.validation.Validator.validate(Validator.java:124)
        at sample.server.ws.handler.SampleHandler.handleMessage(SampleHandler.java:45)

          Issue Links

            Activity

            Hide
            ocerny Ondrej Cerny added a comment -
            Counterpart bug created in JAXWS tracker: https://java.net/jira/browse/JAX_WS-1188
            Show
            ocerny Ondrej Cerny added a comment - Counterpart bug created in JAXWS tracker: https://java.net/jira/browse/JAX_WS-1188
            Show
            aefimov Aleksej Efimov added a comment - OpenJDK review thread: http://mail.openjdk.java.net/pipermail/core-libs-dev/2017-January/045785.html
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/dev/jaxws/rev/a98174edd246
            User: aefimov
            Date: 2017-01-10 19:16:44 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/jaxws/rev/a98174edd246 User: aefimov Date: 2017-01-10 19:16:44 +0000
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/766677da17b5
            User: aefimov
            Date: 2017-01-10 19:17:35 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/766677da17b5 User: aefimov Date: 2017-01-10 19:17:35 +0000
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/jdk9/jaxws/rev/a98174edd246
            User: lana
            Date: 2017-01-18 22:12:52 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/jaxws/rev/a98174edd246 User: lana Date: 2017-01-18 22:12:52 +0000
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/766677da17b5
            User: lana
            Date: 2017-01-18 22:12:57 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/766677da17b5 User: lana Date: 2017-01-18 22:12:57 +0000

              People

              • Assignee:
                aefimov Aleksej Efimov
                Reporter:
                shadowbug Shadow Bug
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: