cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gareth Powell (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CXF-3958) Unmarshalling error when using collections of subtypes with the StaxTransformFeature and 'out' transformations
Date Tue, 06 Dec 2011 11:05:40 GMT
Unmarshalling error when using collections of subtypes with the StaxTransformFeature and 'out'
transformations
--------------------------------------------------------------------------------------------------------------

                 Key: CXF-3958
                 URL: https://issues.apache.org/jira/browse/CXF-3958
             Project: CXF
          Issue Type: Bug
          Components: Configuration, Core, JAXB Databinding
    Affects Versions: 2.5, 2.4
            Reporter: Gareth Powell
            Priority: Blocker
         Attachments: cxf-versioning-bug.zip

We are using the StaxTransformFeature to aid with the versioning of a number or our web services
but have hit upon a problem when invoking a web method that returns a collection of subtypes.
When the StaxTransformFeature (specifically, the out element transforms) are used, the resultant
SOAP payload is malformed, and JAXB cannot unmarshall the collection. Below is an example
of the payload we get back:

       <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="xsi">
           <soap:Body>
               <ns2:getVehiclesResponse xmlns:ns2="example-1.0">
                   <vehicles>
                       <vehicle xsi:type="ns2:bicycle" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                           <name>Marin</name>
                       </vehicle>
                       <vehicle xsi:type="ns2:car">
                           <name>Ferrari</name>
                       </vehicle>
                       <vehicle xsi:type="ns2:motorcycle">
                           <name>Yamaha</name>
                       </vehicle>
                   </vehicles>
               </ns2:getVehiclesResponse>
           </soap:Body>
       </soap:Envelope>

When we invoke the same service, but without the StaxTransformFeature, then we get correct
xml and JAXB is happy. A correct payload is shown below. As you can clearly see, the difference
between the two is that the correct one includes 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
for each instance of the subtype, whereas the broken one, only has it for the first element
in the collection. I have attached a sample project in a zip file that demonstrated the problem.
It's a simple maven project, so just run 'mvn test' to see the test failure.

       <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
           <soap:Body>
               <ns2:getVehiclesResponse xmlns:ns2="example-1.0">
                   <vehicles>
                       <vehicle xsi:type="ns2:bicycle" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                           <name>Marin</name>
                       </vehicle>
                       <vehicle xsi:type="ns2:car" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                           <name>Ferrari</name>
                       </vehicle>
                       <vehicle xsi:type="ns2:motorcycle" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                           <name>Yamaha</name>
                       </vehicle>
                   </vehicles>
               </ns2:getVehiclesResponse>
           </soap:Body>
       </soap:Envelope>

This is a BLOCKER issue for us at the moment and we require urgent resolution. Can you please
advise as to whether there is something we can do to either correct or work around the problem.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message