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

When WebService messages contain nil elements the received payloads are not well formed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 6u12
    • other-libs
    • None
    • x86
    • windows_2008

      There is a regression in "Java 6 Update 12 b02" versus "Java 6 Update 2" in the JAX-WS layer.

      More precisely, the problem occurs on the server side for web services which use the WebServiceProvider annotation to process the payload themselves. When the original message contains nil elements, the received payload is a not-well-formed XML document (because it fails to define the prefix for the http://www.w3.org/2001/XMLSchema-instance namespace).



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Consider the following SOAP request:
      <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
       <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <ping xmlns="urn:com:dassault_systemes:webservice">
         <iSentence xsi:nil="true"/>
        </ping>
       </s:Body>
      </s:Envelope>



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      With Java 6 Update 2, the requestSource contains the correct following message:

        <ping xmlns="urn:com:dassault_systemes:webservice" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance >
         <iSentence xsi:nil="true"/>
        </ping>


      ACTUAL -
      With Java 6 Update 12 (b02), when the public Source invoke(Source requestSource) method of the web service gets invoked, the requestSource contains the following not well-formed XML:

        <ping xmlns="urn:com:dassault_systemes:webservice">
         <iSentence xsi:nil="true"/>
        </ping>

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      There is no error message echoed with JRE/JDK: as we point out here, the request is not well formed so our application fails afterward with errors not relevant for this Bug submital.

      REPRODUCIBILITY :
      This bug can be reproduced always.


      Here's a snipet of our web services implementation class:
      ---------- BEGIN SOURCE ----------
      @WebServiceProvider (serviceName = "PingService",
                           portName = "IPingService",
                           targetNamespace = "urn:com:dassault_systemes:webservice",
                           wsdlLocation = "wsdl/PingService_was.wsdl")
      @ServiceMode(value=Service.Mode.PAYLOAD)
      public class PingService implements Provider <Source> {


         public Source invoke(Source requestSource) {
            ...
         }

      ---------- END SOURCE ----------

      no workaround for this issue found

      The customer has filed a bug at bugs.sun.com (has been assigned an internal review ID of 1419947)
      The test program (main is in com.dassault_systemes.App) and dependencies joined as attachement (jar file)
      I downloaded all jre 6 versions between u2 and u12beta and tested them all.
      The result is that this regression appears between u3 and u4. So in u3 no problem. The problem occurs from u4 and above.
      (Below the output of the program with u3 and u4):


      java version "1.6.0_03"
      Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
      Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)

      Request: <?xml version="1.0" encoding="UTF-8"?><ping xmlns="urn:com:dassault_systemes:webservice"> <iSentence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/> </ping>
      Response: <?xml version="1.0" ?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <pingResponse xmlns="urn:com:dassault_systemes:webservice" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <oWordCount>0</oWordCount> </pingResponse> </S:Body></S:Envelope></soapenv:Body></soapenv:Envelope>

      -------------------------------------------------------------------------------------------

      java version "1.6.0_04"
      Java(TM) SE Runtime Environment (build 1.6.0_04-b12)
      Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)

      Request: <?xml version="1.0" encoding="UTF-8"?><ping xmlns="urn:com:dassault_systemes:webservice"> <iSentence xsi:nil="true"/> </ping>
      Jan 9, 2009 6:52:00 PM org.apache.commons.httpclient.HttpMethodBase getResponseBody
      WARNING: Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
      Response: <?xml version="1.0" ?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <pingResponse xmlns="urn:com:dassault_systemes:webservice" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <oWordCount>0</oWordCount> </pingResponse> </S:Body></S:Envelope></S:Body></S:Envelope>
      The problem was reproduced on Solaris 10 SPARC. The problem is the same and occures from JRE 6 uprade 4 and above.

      To reproduce the problem, download the attached jar file and unjar it. To execute tes test program:
      # java -cp . com.dassault_systemes.App

      Look at the first line of the output. The normal behaviour should print:

       <iSentence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>

      from Java 6 u4 and above we get:
       
       <iSentence xsi:nil="true"/>

            Unassigned Unassigned
            ajavansh Amir Javanshir (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: