You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Marco <bi...@gmail.com> on 2012/01/16 22:15:09 UTC

jaxb problems with cxf 2.5.x

Hello,

I was trying to upgrade from cxf 2.4.x to 2.5.x and I ran into some failures
in some of my tests because the new version is generating slightly different
wsdls. I tracked it down to the jaxb library which changed from 2.2.1 to
2.2.4 (strangely enough, the api library version is 2.2.3 but the impl is
2.2.4-1). 

Basically, for the following class:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name="", propOrder={"number",})
@XmlRootElement
public class Response {
  @XmlElement(name="Number", namespace="http://xml.test.com/ns/test")
  protected double number;
}

If I set com.sun.xml.defaultNamespaceRemap="http://xml.test.com/ns/other",
version 2.2.1 generates the following xsds:

******** schema1.xsd ***********
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" targetNamespace="http://xml.test.com/ns/test"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Number" type="xs:double"/>
</xs:schema>

******** schema2.xsd ***********
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" targetNamespace="http://xml.test.com/ns/other"
xmlns:ns1="http://xml.test.com/ns/test"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:import namespace="http://xml.test.com/ns/test"
schemaLocation="schema1.xsd"/>
  <xs:element name="response">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="ns1:Number"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

While version 2.2.4 generates these:

******** schema1.xsd ***********
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" targetNamespace="http://xml.test.com/ns/test"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Number" type="xs:double"/>
</xs:schema>

******** schema2.xsd ***********
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" targetNamespace="http://xml.test.com/ns/other"
xmlns:ns1="http://xml.test.com/ns/test"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:import namespace="http://xml.test.com/ns/test"
schemaLocation="schema1.xsd"/>
  <xs:element name="response">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Number" type="xs:double" form="qualified"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>


Any idea why this is happening?

--
View this message in context: http://cxf.547215.n5.nabble.com/jaxb-problems-with-cxf-2-5-x-tp5149895p5149895.html
Sent from the cxf-dev mailing list archive at Nabble.com.

Re: jaxb problems with cxf 2.5.x

Posted by Daniel Kulp <dk...@apache.org>.
Interesting.   I really have no idea.   I would suggest posting this to the 
jaxb mailing lists:

http://java.net/projects/jaxb/lists/

and see if they have any thoughts.

Dan



On Monday, January 16, 2012 1:15:09 PM Marco wrote:
> Hello,
> 
> I was trying to upgrade from cxf 2.4.x to 2.5.x and I ran into some failures
> in some of my tests because the new version is generating slightly
> different wsdls. I tracked it down to the jaxb library which changed from
> 2.2.1 to 2.2.4 (strangely enough, the api library version is 2.2.3 but the
> impl is 2.2.4-1).
>
> 
> Basically, for the following class:
> 
> @XmlAccessorType(XmlAccessType.FIELD)
> @XmlType(name="", propOrder={"number",})
> @XmlRootElement
> public class Response {
>   @XmlElement(name="Number", namespace="http://xml.test.com/ns/test")
>   protected double number;
> }
> 
> If I set com.sun.xml.defaultNamespaceRemap="http://xml.test.com/ns/other",
> version 2.2.1 generates the following xsds:
> 
> ******** schema1.xsd ***********
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <xs:schema version="1.0" targetNamespace="http://xml.test.com/ns/test"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>   <xs:element name="Number" type="xs:double"/>
> </xs:schema>
> 
> ******** schema2.xsd ***********
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <xs:schema version="1.0" targetNamespace="http://xml.test.com/ns/other"
> xmlns:ns1="http://xml.test.com/ns/test"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>   <xs:import namespace="http://xml.test.com/ns/test"
> schemaLocation="schema1.xsd"/>
>   <xs:element name="response">
>     <xs:complexType>
>       <xs:sequence>
>         <xs:element ref="ns1:Number"/>
>       </xs:sequence>
>     </xs:complexType>
>   </xs:element>
> </xs:schema>
> 
> While version 2.2.4 generates these:
> 
> ******** schema1.xsd ***********
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <xs:schema version="1.0" targetNamespace="http://xml.test.com/ns/test"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>   <xs:element name="Number" type="xs:double"/>
> </xs:schema>
> 
> ******** schema2.xsd ***********
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <xs:schema version="1.0" targetNamespace="http://xml.test.com/ns/other"
> xmlns:ns1="http://xml.test.com/ns/test"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>   <xs:import namespace="http://xml.test.com/ns/test"
> schemaLocation="schema1.xsd"/>
>   <xs:element name="response">
>     <xs:complexType>
>       <xs:sequence>
>         <xs:element name="Number" type="xs:double" form="qualified"/>
>       </xs:sequence>
>     </xs:complexType>
>   </xs:element>
> </xs:schema>
> 
> 
> Any idea why this is happening?
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/jaxb-problems-with-cxf-2-5-x-tp5149895p5149
> 895.html Sent from the cxf-dev mailing list archive at Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com