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

Java first with unqualified/unannotated JAXB objects don't generate proper soap messages....

Details

    Description

      In a java first scenario, if the service interface/impl is set for the default of wrapped doc/lit and returns a simple pojo bean with no annotations, (thus no namespace set so defaults to unqualified), AND the user does not run wsdl2java with -s to generate the wrapper beans, the service doesn't work.

      The resulting soap message is not correct. The WrappedOutInterceptor sets the default namespace to the namespace of the wrapper type. However, the jaxb databinding does not "unset" that when it writes. Thus, you get something like:
      <getJerkResponse xmlns="http://server.token.example.com/endpoint">
      <ns2:result xmlns:ns2="http://server.token.example.com/endpoint">
      <jerkName>somebody</jerkName>
      </ns2:result>
      </getJerkResponse>
      The "jerkName" element ends up qualified in the parser

      Next problem. If I fixed the WrappedOut to qualify the getJerkReponse element, you get:
      <ns1:getJerkResponse xmlns:ns1="http://server.token.example.com/endpoint">
      <ns2:result xmlns:ns2="http://server.token.example.com/endpoint">
      <jerkName>somebody</jerkName>
      </ns2:result>
      </ns1:getJerkResponse>
      which also is incorrect. The "result" element should be unqualified. The part names in the unwrapped operation should have null namespaces if the schema is unqualified. Thus, the JAXBElement that is used to write the parts would be properly unqualified.

      Attachments

        Activity

          mister_lake Michael Lake added a comment -

          Can be worked around by creating a file in your package of types to be marshalled called package-info.java

          put something like the following into it:

          @javax.xml.bind.annotation.XmlSchema(namespace = "http://wstypes.server.example.com",
          elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
          package com.example.token.server.wstypes;

          mister_lake Michael Lake added a comment - Can be worked around by creating a file in your package of types to be marshalled called package-info.java put something like the following into it: @javax.xml.bind.annotation.XmlSchema(namespace = "http://wstypes.server.example.com", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package com.example.token.server.wstypes;

          People

            dkulp Daniel Kulp
            dkulp Daniel Kulp
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: