From 76e0b6a97b7648d8a7e79ae6b84799c3cf32c402 Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende <gu.martinm@gmail.com> Date: Sun, 27 Dec 2015 03:48:05 +0100 Subject: [PATCH] jaxb and cxf: trying to make work Eclipse XML validations (no way) --- .../build-resources/bindings/custombinding.xjb | 10 +- .../src/main/build-resources/wsdl/example.wsdl | 158 ++++++++++---------- .../src/main/resources/examples.xsd | 163 +++++++++++---------- .../src/main/resources/parent.xsd | 69 ++++----- .../build-resources/bindings/custombinding.xjb | 4 +- .../src/main/resources/examples.xsd | 163 +++++++++++---------- .../src/main/build-resources/wsdl/example.wsdl | 158 ++++++++++---------- .../src/main/resources/schemas/examples.xsd | 163 +++++++++++---------- .../src/main/resources/schemas/parent.xsd | 69 ++++----- .../build-resources/bindings/custombinding.xjb | 4 +- .../src/main/resources/schemas/examples.xsd | 163 +++++++++++---------- 11 files changed, 565 insertions(+), 559 deletions(-) diff --git a/cxf/web-services-spring-cxf-client/src/main/build-resources/bindings/custombinding.xjb b/cxf/web-services-spring-cxf-client/src/main/build-resources/bindings/custombinding.xjb index 38ddbe1..d573e11 100644 --- a/cxf/web-services-spring-cxf-client/src/main/build-resources/bindings/custombinding.xjb +++ b/cxf/web-services-spring-cxf-client/src/main/build-resources/bindings/custombinding.xjb @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" ?> <jaxws:bindings - xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" @@ -28,7 +28,7 @@ (perhaps using maven-jaxb2-plugin with episodes) --> <jaxws:bindings - node="wsdl:definitions/wsdl:types/xs:schema[@targetNamespace='http://gumartinm.name/spring-ws/example']"> + node="wsdl:definitions/wsdl:types/xsd:schema[@targetNamespace='http://gumartinm.name/spring-ws/example']"> <!-- Perhaps it would be better to relay on the package generated automatically from WSDL @@ -38,19 +38,19 @@ <jaxb:package name="de.spring.webservices.client.auto"/> </jaxb:schemaBindings> - <jaxb:bindings node="//xs:element[@name='CustomBindingExampleRequest']/xs:complextype"> + <jaxb:bindings node="//xsd:element[@name='CustomBindingExampleRequest']/xsd:complextype"> <inheritance:implements>de.spring.webservices.operations.Request</inheritance:implements> <annox:annotate>@java.lang.suppresswarnings({"unchecked","rawtypes"})</annox:annotate> </jaxb:bindings> - <jaxb:bindings node="//xs:element[@name='CustomBindingExampleResponse']/xs:complextype"> + <jaxb:bindings node="//xsd:element[@name='CustomBindingExampleResponse']/xsd:complextype"> <inheritance:implements>de.spring.webservices.operations.Response</inheritance:implements> <annox:annotate>@java.lang.suppresswarnings({"unchecked","rawtypes"})</annox:annotate> </jaxb:bindings> <jaxb:globalBindings> <xjc:javaType adapter="de.spring.webservices.binders.XSDateTimeCustomBinder" - name="java.util.Date" xmlType="xs:dateTime" /> + name="java.util.Date" xmlType="xsd:dateTime" /> </jaxb:globalBindings> </jaxws:bindings> diff --git a/cxf/web-services-spring-cxf-client/src/main/build-resources/wsdl/example.wsdl b/cxf/web-services-spring-cxf-client/src/main/build-resources/wsdl/example.wsdl index 20ce10e..e3f61ed 100644 --- a/cxf/web-services-spring-cxf-client/src/main/build-resources/wsdl/example.wsdl +++ b/cxf/web-services-spring-cxf-client/src/main/build-resources/wsdl/example.wsdl @@ -1,21 +1,21 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:sch="http://gumartinm.name/spring-ws/example" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://gumartinm.name/spring-ws/exampleService" targetNamespace="http://gumartinm.name/spring-ws/exampleService"> <wsdl:types> - <xs:schema xmlns:annox="http://annox.dev.java.net" xmlns:example="http://gumartinm.name/spring-ws/example" xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:parent="http://gumartinm.name/spring-ws/parent" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" jaxb:extensionBindingPrefixes="inheritance annox" jaxb:version="2.1" targetNamespace="http://gumartinm.name/spring-ws/example"> + <xsd:schema xmlns="http://gumartinm.name/spring-ws/example" xmlns:annox="http://annox.dev.java.net" xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:parent="http://gumartinm.name/spring-ws/parent" xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" jaxb:extensionBindingPrefixes="inheritance annox" jaxb:version="2.1" targetNamespace="http://gumartinm.name/spring-ws/example"> <!-- When should an item be declared as an element versus when should it be defined as a type? When in doubt, make it a type. You can always create an element from the type, if needed. With a type, other elements can reuse that type. - <xs:all> specifies that the child elements can appear in any order. + <xsd:all> specifies that the child elements can appear in any order. - <xs:sequence> specifies child elements can only appear in the order mentioned. + <xsd:sequence> specifies child elements can only appear in the order mentioned. --> <!-- We are going to use catalog.cat in order to avoid downloading parent.xsd from remote server when creating Java objects from examples.xsd. --> - <xs:import namespace="http://gumartinm.name/spring-ws/parent" schemaLocation="http://gumartinm.name/spring-ws/parent/parent.xsd"/> + <xsd:import namespace="http://gumartinm.name/spring-ws/parent" schemaLocation="http://gumartinm.name/spring-ws/parent/parent.xsd"/> <!-- Spring requires the following: @@ -29,93 +29,93 @@ The same for CustomBindingExample. --> <!-- Using inheritance and annox plugin --> - <xs:element name="ExampleRequest"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> + <xsd:element name="ExampleRequest"> + <xsd:complexType> + <xsd:annotation> + <xsd:appinfo> <annox:annotate>@java.lang.SuppressWarnings({"unchecked","rawtypes"})</annox:annotate> <inheritance:implements>de.spring.webservices.operations.Request</inheritance:implements> - </xs:appinfo> - </xs:annotation> - <xs:all> - <xs:element name="data" type="parent:limitedString"/> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="ExampleResponse"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> + </xsd:appinfo> + </xsd:annotation> + <xsd:all> + <xsd:element name="data" type="parent:limitedString"/> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="ExampleResponse"> + <xsd:complexType> + <xsd:annotation> + <xsd:appinfo> <inheritance:implements>de.spring.webservices.operations.Response</inheritance:implements> - </xs:appinfo> - </xs:annotation> - <xs:all> - <xs:element name="data" type="xs:string"/> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="ExampleFault"> - <xs:complexType> - <xs:sequence> - <xs:element ref="parent:GeneralFault"/> - </xs:sequence> - </xs:complexType> - </xs:element> + </xsd:appinfo> + </xsd:annotation> + <xsd:all> + <xsd:element name="data" type="xsd:string"/> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="ExampleFault"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="parent:GeneralFault"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> <!-- Using custombinding.xjb instead of inheritance plugin. Useful when you can not modify your xsd files because they are provided by another person or company --> - <xs:element name="CustomBindingExampleRequest"> - <xs:complexType> - <xs:all> - <xs:element name="data" type="xs:string"/> - <xs:element maxOccurs="1" minOccurs="0" name="exampleDate" type="xs:dateTime"/> - <xs:element maxOccurs="1" minOccurs="0" name="parentEnum" type="parent:parentEnumType"/> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="CustomBindingExampleResponse"> - <xs:complexType> - <xs:all> - <xs:element name="data" type="xs:string"/> - <xs:element maxOccurs="1" minOccurs="0" name="exampleDate" type="xs:dateTime"/> - <xs:element maxOccurs="1" minOccurs="0" name="parentEnum" type="parent:parentEnumType"/> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="CustomBindingExampleFault"> - <xs:complexType> - <xs:sequence> - <xs:element ref="parent:GeneralFault"/> - </xs:sequence> - </xs:complexType> - </xs:element> + <xsd:element name="CustomBindingExampleRequest"> + <xsd:complexType> + <xsd:all> + <xsd:element name="data" type="xsd:string"/> + <xsd:element maxOccurs="1" minOccurs="0" name="exampleDate" type="xsd:dateTime"/> + <xsd:element maxOccurs="1" minOccurs="0" name="parentEnum" type="parent:parentEnumType"/> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="CustomBindingExampleResponse"> + <xsd:complexType> + <xsd:all> + <xsd:element name="data" type="xsd:string"/> + <xsd:element maxOccurs="1" minOccurs="0" name="exampleDate" type="xsd:dateTime"/> + <xsd:element maxOccurs="1" minOccurs="0" name="parentEnum" type="parent:parentEnumType"/> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="CustomBindingExampleFault"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="parent:GeneralFault"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> <!-- Example of creating array list by means of XSD --> - <xs:complexType name="car"> - <xs:sequence> - <xs:element name="data" type="xs:string"/> - <xs:element maxOccurs="100" minOccurs="0" name="parentEnum" type="parent:parentEnumType"/> - </xs:sequence> - </xs:complexType> - <xs:complexType name="truck"> - <xs:all> - <xs:element name="data" type="xs:string"/> - <xs:element maxOccurs="1" minOccurs="0" name="parentEnum" type="parent:parentEnumType"/> - </xs:all> - </xs:complexType> - <xs:element name="vehicles"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" name="cars" type="example:car"/> - <xs:element maxOccurs="100" minOccurs="0" name="trucks" type="example:truck"/> - </xs:sequence> - </xs:complexType> - </xs:element> + <xsd:complexType name="car"> + <xsd:sequence> + <xsd:element name="data" type="xsd:string"/> + <xsd:element maxOccurs="100" minOccurs="0" name="parentEnum" type="parent:parentEnumType"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="truck"> + <xsd:all> + <xsd:element name="data" type="xsd:string"/> + <xsd:element maxOccurs="1" minOccurs="0" name="parentEnum" type="parent:parentEnumType"/> + </xsd:all> + </xsd:complexType> + <xsd:element name="vehicles"> + <xsd:complexType> + <xsd:sequence> + <xsd:element maxOccurs="unbounded" name="cars" type="car"/> + <xsd:element maxOccurs="100" minOccurs="0" name="trucks" type="truck"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> -</xs:schema> +</xsd:schema> </wsdl:types> <wsdl:message name="ExampleFault"> <wsdl:part element="sch:ExampleFault" name="ExampleFault"> diff --git a/cxf/web-services-spring-cxf-client/src/main/resources/examples.xsd b/cxf/web-services-spring-cxf-client/src/main/resources/examples.xsd index e419711..59cd317 100644 --- a/cxf/web-services-spring-cxf-client/src/main/resources/examples.xsd +++ b/cxf/web-services-spring-cxf-client/src/main/resources/examples.xsd @@ -1,29 +1,30 @@ <?xml version="1.0" encoding="UTF-8" ?> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" +<xsd:schema xmlns="http://gumartinm.name/spring-ws/example" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:parent="http://gumartinm.name/spring-ws/parent" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance" xmlns:annox="http://annox.dev.java.net" - xmlns:example="http://gumartinm.name/spring-ws/example" jaxb:version="2.1" jaxb:extensionBindingPrefixes="inheritance annox" + targetNamespace="http://gumartinm.name/spring-ws/example" elementFormDefault="qualified" - targetNamespace="http://gumartinm.name/spring-ws/example"> + attributeFormDefault="unqualified"> <!-- When should an item be declared as an element versus when should it be defined as a type? When in doubt, make it a type. You can always create an element from the type, if needed. With a type, other elements can reuse that type. - <xs:all> specifies that the child elements can appear in any order. + <xsd:all> specifies that the child elements can appear in any order. - <xs:sequence> specifies child elements can only appear in the order mentioned. + <xsd:sequence> specifies child elements can only appear in the order mentioned. --> <!-- We are going to use catalog.cat in order to avoid downloading parent.xsd from remote server when creating Java objects from examples.xsd. --> - <xs:import namespace="http://gumartinm.name/spring-ws/parent" schemaLocation="http://gumartinm.name/spring-ws/parent/parent.xsd" /> + <xsd:import namespace="http://gumartinm.name/spring-ws/parent" schemaLocation="http://gumartinm.name/spring-ws/parent/parent.xsd" /> <!-- Spring requires the following: @@ -37,90 +38,90 @@ The same for CustomBindingExample. --> <!-- Using inheritance and annox plugin --> - <xs:element name="ExampleRequest"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> + <xsd:element name="ExampleRequest"> + <xsd:complexType> + <xsd:annotation> + <xsd:appinfo> <annox:annotate>@java.lang.SuppressWarnings({"unchecked","rawtypes"})</annox:annotate> <inheritance:implements>de.spring.webservices.operations.Request</inheritance:implements> - </xs:appinfo> - </xs:annotation> - <xs:all> - <xs:element name="data" type="parent:limitedString" /> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="ExampleResponse"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> + </xsd:appinfo> + </xsd:annotation> + <xsd:all> + <xsd:element name="data" type="parent:limitedString" /> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="ExampleResponse"> + <xsd:complexType> + <xsd:annotation> + <xsd:appinfo> <inheritance:implements>de.spring.webservices.operations.Response</inheritance:implements> - </xs:appinfo> - </xs:annotation> - <xs:all> - <xs:element name="data" type="xs:string" /> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="ExampleFault"> - <xs:complexType> - <xs:sequence> - <xs:element ref="parent:GeneralFault" /> - </xs:sequence> - </xs:complexType> - </xs:element> + </xsd:appinfo> + </xsd:annotation> + <xsd:all> + <xsd:element name="data" type="xsd:string" /> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="ExampleFault"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="parent:GeneralFault" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> <!-- Using custombinding.xjb instead of inheritance plugin. Useful when you can not modify your xsd files because they are provided by another person or company --> - <xs:element name="CustomBindingExampleRequest"> - <xs:complexType> - <xs:all> - <xs:element name="data" type="xs:string" /> - <xs:element name="exampleDate" type="xs:dateTime" minOccurs="0" maxOccurs="1" /> - <xs:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="CustomBindingExampleResponse"> - <xs:complexType> - <xs:all> - <xs:element name="data" type="xs:string" /> - <xs:element name="exampleDate" type="xs:dateTime" minOccurs="0" maxOccurs="1" /> - <xs:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="CustomBindingExampleFault"> - <xs:complexType> - <xs:sequence> - <xs:element ref="parent:GeneralFault" /> - </xs:sequence> - </xs:complexType> - </xs:element> + <xsd:element name="CustomBindingExampleRequest"> + <xsd:complexType> + <xsd:all> + <xsd:element name="data" type="xsd:string" /> + <xsd:element name="exampleDate" type="xsd:dateTime" minOccurs="0" maxOccurs="1" /> + <xsd:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="CustomBindingExampleResponse"> + <xsd:complexType> + <xsd:all> + <xsd:element name="data" type="xsd:string" /> + <xsd:element name="exampleDate" type="xsd:dateTime" minOccurs="0" maxOccurs="1" /> + <xsd:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="CustomBindingExampleFault"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="parent:GeneralFault" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> <!-- Example of creating array list by means of XSD --> - <xs:complexType name="car"> - <xs:sequence> - <xs:element name="data" type="xs:string" /> - <xs:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="100" /> - </xs:sequence> - </xs:complexType> - <xs:complexType name="truck"> - <xs:all> - <xs:element name="data" type="xs:string" /> - <xs:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> - </xs:all> - </xs:complexType> - <xs:element name="vehicles"> - <xs:complexType> - <xs:sequence> - <xs:element name="cars" type="example:car" maxOccurs="unbounded" /> - <xs:element name="trucks" type="example:truck" minOccurs="0" maxOccurs="100" /> - </xs:sequence> - </xs:complexType> - </xs:element> + <xsd:complexType name="car"> + <xsd:sequence> + <xsd:element name="data" type="xsd:string" /> + <xsd:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="truck"> + <xsd:all> + <xsd:element name="data" type="xsd:string" /> + <xsd:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> + </xsd:all> + </xsd:complexType> + <xsd:element name="vehicles"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="cars" type="car" maxOccurs="unbounded" /> + <xsd:element name="trucks" type="truck" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> -</xs:schema> +</xsd:schema> diff --git a/cxf/web-services-spring-cxf-globalxsds/src/main/resources/parent.xsd b/cxf/web-services-spring-cxf-globalxsds/src/main/resources/parent.xsd index 165c6fd..b38ca36 100644 --- a/cxf/web-services-spring-cxf-globalxsds/src/main/resources/parent.xsd +++ b/cxf/web-services-spring-cxf-globalxsds/src/main/resources/parent.xsd @@ -1,48 +1,49 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" - xmlns:parent="http://gumartinm.name/spring-ws/parent" +<?xml version="1.0" encoding="UTF-8" ?> +<xsd:schema xmlns="http://gumartinm.name/spring-ws/parent" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" + attributeFormDefault="unqualified" targetNamespace="http://gumartinm.name/spring-ws/parent"> <!-- When should an item be declared as an element versus when should it be defined as a type? When in doubt, make it a type. You can always create an element from the type, if needed. With a type, other elements can reuse that type. - <xs:all> specifies that the child elements can appear in any order. + <xsd:all> specifies that the child elements can appear in any order. - <xs:sequence> specifies child elements can only appear in the order mentioned. + <xsd:sequence> specifies child elements can only appear in the order mentioned. --> - <xs:simpleType name="parentEnumType"> - <xs:restriction base="xs:token"> - <xs:enumeration value="FIRST"/> - <xs:enumeration value="SECOND"/> - <xs:enumeration value="THIRD"/> - <xs:enumeration value="FOURTH"/> - <xs:enumeration value="FIVETH"/> - </xs:restriction> - </xs:simpleType> + <xsd:simpleType name="parentEnumType"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="FIRST"/> + <xsd:enumeration value="SECOND"/> + <xsd:enumeration value="THIRD"/> + <xsd:enumeration value="FOURTH"/> + <xsd:enumeration value="FIVETH"/> + </xsd:restriction> + </xsd:simpleType> - <xs:simpleType name="limitedString"> - <xs:restriction base="xs:string"> - <xs:maxLength value="30" /> - </xs:restriction> - </xs:simpleType> + <xsd:simpleType name="limitedString"> + <xsd:restriction base="xsd:string"> + <xsd:maxLength value="30" /> + </xsd:restriction> + </xsd:simpleType> - <xs:complexType name="element"> - <xs:sequence> - <xs:element name="message" type="xs:string"/> - <xs:element name="messageArgs" type="xs:string" minOccurs="0" maxOccurs="100"/> - </xs:sequence> - </xs:complexType> + <xsd:complexType name="element"> + <xsd:sequence> + <xsd:element name="message" type="xsd:string"/> + <xsd:element name="messageArgs" type="xsd:string" minOccurs="0" maxOccurs="100"/> + </xsd:sequence> + </xsd:complexType> - <xs:element name="GeneralFault"> - <xs:complexType> - <xs:sequence> - <xs:element name="technicalError" type="xs:string" /> - <xs:element name="elements" type="parent:element" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> + <xsd:element name="GeneralFault"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="technicalError" type="xsd:string" /> + <xsd:element name="elements" type="element" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> -</xs:schema> +</xsd:schema> diff --git a/cxf/web-services-spring-cxf-server/src/main/build-resources/bindings/custombinding.xjb b/cxf/web-services-spring-cxf-server/src/main/build-resources/bindings/custombinding.xjb index a1430d5..60740a4 100644 --- a/cxf/web-services-spring-cxf-server/src/main/build-resources/bindings/custombinding.xjb +++ b/cxf/web-services-spring-cxf-server/src/main/build-resources/bindings/custombinding.xjb @@ -40,12 +40,12 @@ <!-- The same applies to annotate. If you do not want or you may not modify your xsd files you can modify instead this file with your custom binding :) --> - <!-- Custom xs:dateTime adapter + <!-- Custom xsd:dateTime adapter See: https://jaxb.java.net/2.2.4/docs/vendorCustomizations.html#javaType --> <jaxb:globalBindings> <xjc:javaType adapter="de.spring.webservices.binders.XSDateTimeCustomBinder" - name="java.util.Date" xmlType="xs:dateTime" /> + name="java.util.Date" xmlType="xsd:dateTime" /> </jaxb:globalBindings> </jaxb:bindings> diff --git a/cxf/web-services-spring-cxf-server/src/main/resources/examples.xsd b/cxf/web-services-spring-cxf-server/src/main/resources/examples.xsd index e419711..59cd317 100644 --- a/cxf/web-services-spring-cxf-server/src/main/resources/examples.xsd +++ b/cxf/web-services-spring-cxf-server/src/main/resources/examples.xsd @@ -1,29 +1,30 @@ <?xml version="1.0" encoding="UTF-8" ?> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" +<xsd:schema xmlns="http://gumartinm.name/spring-ws/example" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:parent="http://gumartinm.name/spring-ws/parent" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance" xmlns:annox="http://annox.dev.java.net" - xmlns:example="http://gumartinm.name/spring-ws/example" jaxb:version="2.1" jaxb:extensionBindingPrefixes="inheritance annox" + targetNamespace="http://gumartinm.name/spring-ws/example" elementFormDefault="qualified" - targetNamespace="http://gumartinm.name/spring-ws/example"> + attributeFormDefault="unqualified"> <!-- When should an item be declared as an element versus when should it be defined as a type? When in doubt, make it a type. You can always create an element from the type, if needed. With a type, other elements can reuse that type. - <xs:all> specifies that the child elements can appear in any order. + <xsd:all> specifies that the child elements can appear in any order. - <xs:sequence> specifies child elements can only appear in the order mentioned. + <xsd:sequence> specifies child elements can only appear in the order mentioned. --> <!-- We are going to use catalog.cat in order to avoid downloading parent.xsd from remote server when creating Java objects from examples.xsd. --> - <xs:import namespace="http://gumartinm.name/spring-ws/parent" schemaLocation="http://gumartinm.name/spring-ws/parent/parent.xsd" /> + <xsd:import namespace="http://gumartinm.name/spring-ws/parent" schemaLocation="http://gumartinm.name/spring-ws/parent/parent.xsd" /> <!-- Spring requires the following: @@ -37,90 +38,90 @@ The same for CustomBindingExample. --> <!-- Using inheritance and annox plugin --> - <xs:element name="ExampleRequest"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> + <xsd:element name="ExampleRequest"> + <xsd:complexType> + <xsd:annotation> + <xsd:appinfo> <annox:annotate>@java.lang.SuppressWarnings({"unchecked","rawtypes"})</annox:annotate> <inheritance:implements>de.spring.webservices.operations.Request</inheritance:implements> - </xs:appinfo> - </xs:annotation> - <xs:all> - <xs:element name="data" type="parent:limitedString" /> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="ExampleResponse"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> + </xsd:appinfo> + </xsd:annotation> + <xsd:all> + <xsd:element name="data" type="parent:limitedString" /> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="ExampleResponse"> + <xsd:complexType> + <xsd:annotation> + <xsd:appinfo> <inheritance:implements>de.spring.webservices.operations.Response</inheritance:implements> - </xs:appinfo> - </xs:annotation> - <xs:all> - <xs:element name="data" type="xs:string" /> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="ExampleFault"> - <xs:complexType> - <xs:sequence> - <xs:element ref="parent:GeneralFault" /> - </xs:sequence> - </xs:complexType> - </xs:element> + </xsd:appinfo> + </xsd:annotation> + <xsd:all> + <xsd:element name="data" type="xsd:string" /> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="ExampleFault"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="parent:GeneralFault" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> <!-- Using custombinding.xjb instead of inheritance plugin. Useful when you can not modify your xsd files because they are provided by another person or company --> - <xs:element name="CustomBindingExampleRequest"> - <xs:complexType> - <xs:all> - <xs:element name="data" type="xs:string" /> - <xs:element name="exampleDate" type="xs:dateTime" minOccurs="0" maxOccurs="1" /> - <xs:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="CustomBindingExampleResponse"> - <xs:complexType> - <xs:all> - <xs:element name="data" type="xs:string" /> - <xs:element name="exampleDate" type="xs:dateTime" minOccurs="0" maxOccurs="1" /> - <xs:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="CustomBindingExampleFault"> - <xs:complexType> - <xs:sequence> - <xs:element ref="parent:GeneralFault" /> - </xs:sequence> - </xs:complexType> - </xs:element> + <xsd:element name="CustomBindingExampleRequest"> + <xsd:complexType> + <xsd:all> + <xsd:element name="data" type="xsd:string" /> + <xsd:element name="exampleDate" type="xsd:dateTime" minOccurs="0" maxOccurs="1" /> + <xsd:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="CustomBindingExampleResponse"> + <xsd:complexType> + <xsd:all> + <xsd:element name="data" type="xsd:string" /> + <xsd:element name="exampleDate" type="xsd:dateTime" minOccurs="0" maxOccurs="1" /> + <xsd:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="CustomBindingExampleFault"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="parent:GeneralFault" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> <!-- Example of creating array list by means of XSD --> - <xs:complexType name="car"> - <xs:sequence> - <xs:element name="data" type="xs:string" /> - <xs:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="100" /> - </xs:sequence> - </xs:complexType> - <xs:complexType name="truck"> - <xs:all> - <xs:element name="data" type="xs:string" /> - <xs:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> - </xs:all> - </xs:complexType> - <xs:element name="vehicles"> - <xs:complexType> - <xs:sequence> - <xs:element name="cars" type="example:car" maxOccurs="unbounded" /> - <xs:element name="trucks" type="example:truck" minOccurs="0" maxOccurs="100" /> - </xs:sequence> - </xs:complexType> - </xs:element> + <xsd:complexType name="car"> + <xsd:sequence> + <xsd:element name="data" type="xsd:string" /> + <xsd:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="truck"> + <xsd:all> + <xsd:element name="data" type="xsd:string" /> + <xsd:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> + </xsd:all> + </xsd:complexType> + <xsd:element name="vehicles"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="cars" type="car" maxOccurs="unbounded" /> + <xsd:element name="trucks" type="truck" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> -</xs:schema> +</xsd:schema> diff --git a/jaxb2/web-services-spring-jaxb2-client/src/main/build-resources/wsdl/example.wsdl b/jaxb2/web-services-spring-jaxb2-client/src/main/build-resources/wsdl/example.wsdl index 2018a37..202d87b 100644 --- a/jaxb2/web-services-spring-jaxb2-client/src/main/build-resources/wsdl/example.wsdl +++ b/jaxb2/web-services-spring-jaxb2-client/src/main/build-resources/wsdl/example.wsdl @@ -1,21 +1,21 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:sch="http://gumartinm.name/spring-ws/example" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://gumartinm.name/spring-ws/exampleService" targetNamespace="http://gumartinm.name/spring-ws/exampleService"> <wsdl:types> - <xs:schema xmlns:annox="http://annox.dev.java.net" xmlns:example="http://gumartinm.name/spring-ws/example" xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:parent="http://gumartinm.name/spring-ws/parent" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" jaxb:extensionBindingPrefixes="inheritance annox" jaxb:version="2.1" targetNamespace="http://gumartinm.name/spring-ws/example"> + <xsd:schema xmlns="http://gumartinm.name/spring-ws/example" xmlns:annox="http://annox.dev.java.net" xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:parent="http://gumartinm.name/spring-ws/parent" xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" jaxb:extensionBindingPrefixes="inheritance annox" jaxb:version="2.1" targetNamespace="http://gumartinm.name/spring-ws/example"> <!-- When should an item be declared as an element versus when should it be defined as a type? When in doubt, make it a type. You can always create an element from the type, if needed. With a type, other elements can reuse that type. - <xs:all> specifies that the child elements can appear in any order. + <xsd:all> specifies that the child elements can appear in any order. - <xs:sequence> specifies child elements can only appear in the order mentioned. + <xsd:sequence> specifies child elements can only appear in the order mentioned. --> <!-- We are going to use catalog.cat in order to avoid downloading parent.xsd from remote server when creating Java objects from examples.xsd. --> - <xs:import namespace="http://gumartinm.name/spring-ws/parent" schemaLocation="http://gumartinm.name/spring-ws/parent/parent.xsd"/> + <xsd:import namespace="http://gumartinm.name/spring-ws/parent" schemaLocation="http://gumartinm.name/spring-ws/parent/parent.xsd"/> <!-- Spring requires the following: @@ -29,93 +29,93 @@ The same for CustomBindingExample. --> <!-- Using inheritance and annox plugin --> - <xs:element name="ExampleRequest"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> + <xsd:element name="ExampleRequest"> + <xsd:complexType> + <xsd:annotation> + <xsd:appinfo> <annox:annotate>@java.lang.SuppressWarnings({"unchecked","rawtypes"})</annox:annotate> <inheritance:implements>de.spring.webservices.operations.Request</inheritance:implements> - </xs:appinfo> - </xs:annotation> - <xs:all> - <xs:element name="data" type="parent:limitedString"/> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="ExampleResponse"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> + </xsd:appinfo> + </xsd:annotation> + <xsd:all> + <xsd:element name="data" type="parent:limitedString"/> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="ExampleResponse"> + <xsd:complexType> + <xsd:annotation> + <xsd:appinfo> <inheritance:implements>de.spring.webservices.operations.Response</inheritance:implements> - </xs:appinfo> - </xs:annotation> - <xs:all> - <xs:element name="data" type="xs:string"/> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="ExampleFault"> - <xs:complexType> - <xs:sequence> - <xs:element ref="parent:GeneralFault"/> - </xs:sequence> - </xs:complexType> - </xs:element> + </xsd:appinfo> + </xsd:annotation> + <xsd:all> + <xsd:element name="data" type="xsd:string"/> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="ExampleFault"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="parent:GeneralFault"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> <!-- Using custombinding.xjb instead of inheritance plugin. Useful when you can not modify your xsd files because they are provided by another person or company --> - <xs:element name="CustomBindingExampleRequest"> - <xs:complexType> - <xs:all> - <xs:element name="data" type="xs:string"/> - <xs:element maxOccurs="1" minOccurs="0" name="exampleDate" type="xs:dateTime"/> - <xs:element maxOccurs="1" minOccurs="0" name="parentEnum" type="parent:parentEnumType"/> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="CustomBindingExampleResponse"> - <xs:complexType> - <xs:all> - <xs:element name="data" type="xs:string"/> - <xs:element maxOccurs="1" minOccurs="0" name="exampleDate" type="xs:dateTime"/> - <xs:element maxOccurs="1" minOccurs="0" name="parentEnum" type="parent:parentEnumType"/> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="CustomBindingExampleFault"> - <xs:complexType> - <xs:sequence> - <xs:element ref="parent:GeneralFault"/> - </xs:sequence> - </xs:complexType> - </xs:element> + <xsd:element name="CustomBindingExampleRequest"> + <xsd:complexType> + <xsd:all> + <xsd:element name="data" type="xsd:string"/> + <xsd:element maxOccurs="1" minOccurs="0" name="exampleDate" type="xsd:dateTime"/> + <xsd:element maxOccurs="1" minOccurs="0" name="parentEnum" type="parent:parentEnumType"/> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="CustomBindingExampleResponse"> + <xsd:complexType> + <xsd:all> + <xsd:element name="data" type="xsd:string"/> + <xsd:element maxOccurs="1" minOccurs="0" name="exampleDate" type="xsd:dateTime"/> + <xsd:element maxOccurs="1" minOccurs="0" name="parentEnum" type="parent:parentEnumType"/> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="CustomBindingExampleFault"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="parent:GeneralFault"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> <!-- Example of creating array list by means of XSD --> - <xs:complexType name="car"> - <xs:sequence> - <xs:element name="data" type="xs:string"/> - <xs:element maxOccurs="100" minOccurs="0" name="parentEnum" type="parent:parentEnumType"/> - </xs:sequence> - </xs:complexType> - <xs:complexType name="truck"> - <xs:all> - <xs:element name="data" type="xs:string"/> - <xs:element maxOccurs="1" minOccurs="0" name="parentEnum" type="parent:parentEnumType"/> - </xs:all> - </xs:complexType> - <xs:element name="vehicles"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" name="cars" type="example:car"/> - <xs:element maxOccurs="100" minOccurs="0" name="trucks" type="example:truck"/> - </xs:sequence> - </xs:complexType> - </xs:element> + <xsd:complexType name="car"> + <xsd:sequence> + <xsd:element name="data" type="xsd:string"/> + <xsd:element maxOccurs="100" minOccurs="0" name="parentEnum" type="parent:parentEnumType"/> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="truck"> + <xsd:all> + <xsd:element name="data" type="xsd:string"/> + <xsd:element maxOccurs="1" minOccurs="0" name="parentEnum" type="parent:parentEnumType"/> + </xsd:all> + </xsd:complexType> + <xsd:element name="vehicles"> + <xsd:complexType> + <xsd:sequence> + <xsd:element maxOccurs="unbounded" name="cars" type="car"/> + <xsd:element maxOccurs="100" minOccurs="0" name="trucks" type="truck"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> -</xs:schema> +</xsd:schema> </wsdl:types> <wsdl:message name="ExampleFault"> <wsdl:part element="sch:ExampleFault" name="ExampleFault"> diff --git a/jaxb2/web-services-spring-jaxb2-client/src/main/resources/schemas/examples.xsd b/jaxb2/web-services-spring-jaxb2-client/src/main/resources/schemas/examples.xsd index e419711..59cd317 100644 --- a/jaxb2/web-services-spring-jaxb2-client/src/main/resources/schemas/examples.xsd +++ b/jaxb2/web-services-spring-jaxb2-client/src/main/resources/schemas/examples.xsd @@ -1,29 +1,30 @@ <?xml version="1.0" encoding="UTF-8" ?> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" +<xsd:schema xmlns="http://gumartinm.name/spring-ws/example" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:parent="http://gumartinm.name/spring-ws/parent" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance" xmlns:annox="http://annox.dev.java.net" - xmlns:example="http://gumartinm.name/spring-ws/example" jaxb:version="2.1" jaxb:extensionBindingPrefixes="inheritance annox" + targetNamespace="http://gumartinm.name/spring-ws/example" elementFormDefault="qualified" - targetNamespace="http://gumartinm.name/spring-ws/example"> + attributeFormDefault="unqualified"> <!-- When should an item be declared as an element versus when should it be defined as a type? When in doubt, make it a type. You can always create an element from the type, if needed. With a type, other elements can reuse that type. - <xs:all> specifies that the child elements can appear in any order. + <xsd:all> specifies that the child elements can appear in any order. - <xs:sequence> specifies child elements can only appear in the order mentioned. + <xsd:sequence> specifies child elements can only appear in the order mentioned. --> <!-- We are going to use catalog.cat in order to avoid downloading parent.xsd from remote server when creating Java objects from examples.xsd. --> - <xs:import namespace="http://gumartinm.name/spring-ws/parent" schemaLocation="http://gumartinm.name/spring-ws/parent/parent.xsd" /> + <xsd:import namespace="http://gumartinm.name/spring-ws/parent" schemaLocation="http://gumartinm.name/spring-ws/parent/parent.xsd" /> <!-- Spring requires the following: @@ -37,90 +38,90 @@ The same for CustomBindingExample. --> <!-- Using inheritance and annox plugin --> - <xs:element name="ExampleRequest"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> + <xsd:element name="ExampleRequest"> + <xsd:complexType> + <xsd:annotation> + <xsd:appinfo> <annox:annotate>@java.lang.SuppressWarnings({"unchecked","rawtypes"})</annox:annotate> <inheritance:implements>de.spring.webservices.operations.Request</inheritance:implements> - </xs:appinfo> - </xs:annotation> - <xs:all> - <xs:element name="data" type="parent:limitedString" /> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="ExampleResponse"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> + </xsd:appinfo> + </xsd:annotation> + <xsd:all> + <xsd:element name="data" type="parent:limitedString" /> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="ExampleResponse"> + <xsd:complexType> + <xsd:annotation> + <xsd:appinfo> <inheritance:implements>de.spring.webservices.operations.Response</inheritance:implements> - </xs:appinfo> - </xs:annotation> - <xs:all> - <xs:element name="data" type="xs:string" /> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="ExampleFault"> - <xs:complexType> - <xs:sequence> - <xs:element ref="parent:GeneralFault" /> - </xs:sequence> - </xs:complexType> - </xs:element> + </xsd:appinfo> + </xsd:annotation> + <xsd:all> + <xsd:element name="data" type="xsd:string" /> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="ExampleFault"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="parent:GeneralFault" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> <!-- Using custombinding.xjb instead of inheritance plugin. Useful when you can not modify your xsd files because they are provided by another person or company --> - <xs:element name="CustomBindingExampleRequest"> - <xs:complexType> - <xs:all> - <xs:element name="data" type="xs:string" /> - <xs:element name="exampleDate" type="xs:dateTime" minOccurs="0" maxOccurs="1" /> - <xs:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="CustomBindingExampleResponse"> - <xs:complexType> - <xs:all> - <xs:element name="data" type="xs:string" /> - <xs:element name="exampleDate" type="xs:dateTime" minOccurs="0" maxOccurs="1" /> - <xs:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="CustomBindingExampleFault"> - <xs:complexType> - <xs:sequence> - <xs:element ref="parent:GeneralFault" /> - </xs:sequence> - </xs:complexType> - </xs:element> + <xsd:element name="CustomBindingExampleRequest"> + <xsd:complexType> + <xsd:all> + <xsd:element name="data" type="xsd:string" /> + <xsd:element name="exampleDate" type="xsd:dateTime" minOccurs="0" maxOccurs="1" /> + <xsd:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="CustomBindingExampleResponse"> + <xsd:complexType> + <xsd:all> + <xsd:element name="data" type="xsd:string" /> + <xsd:element name="exampleDate" type="xsd:dateTime" minOccurs="0" maxOccurs="1" /> + <xsd:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="CustomBindingExampleFault"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="parent:GeneralFault" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> <!-- Example of creating array list by means of XSD --> - <xs:complexType name="car"> - <xs:sequence> - <xs:element name="data" type="xs:string" /> - <xs:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="100" /> - </xs:sequence> - </xs:complexType> - <xs:complexType name="truck"> - <xs:all> - <xs:element name="data" type="xs:string" /> - <xs:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> - </xs:all> - </xs:complexType> - <xs:element name="vehicles"> - <xs:complexType> - <xs:sequence> - <xs:element name="cars" type="example:car" maxOccurs="unbounded" /> - <xs:element name="trucks" type="example:truck" minOccurs="0" maxOccurs="100" /> - </xs:sequence> - </xs:complexType> - </xs:element> + <xsd:complexType name="car"> + <xsd:sequence> + <xsd:element name="data" type="xsd:string" /> + <xsd:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="truck"> + <xsd:all> + <xsd:element name="data" type="xsd:string" /> + <xsd:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> + </xsd:all> + </xsd:complexType> + <xsd:element name="vehicles"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="cars" type="car" maxOccurs="unbounded" /> + <xsd:element name="trucks" type="truck" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> -</xs:schema> +</xsd:schema> diff --git a/jaxb2/web-services-spring-jaxb2-globalxsds/src/main/resources/schemas/parent.xsd b/jaxb2/web-services-spring-jaxb2-globalxsds/src/main/resources/schemas/parent.xsd index 165c6fd..b38ca36 100644 --- a/jaxb2/web-services-spring-jaxb2-globalxsds/src/main/resources/schemas/parent.xsd +++ b/jaxb2/web-services-spring-jaxb2-globalxsds/src/main/resources/schemas/parent.xsd @@ -1,48 +1,49 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" - xmlns:parent="http://gumartinm.name/spring-ws/parent" +<?xml version="1.0" encoding="UTF-8" ?> +<xsd:schema xmlns="http://gumartinm.name/spring-ws/parent" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" + attributeFormDefault="unqualified" targetNamespace="http://gumartinm.name/spring-ws/parent"> <!-- When should an item be declared as an element versus when should it be defined as a type? When in doubt, make it a type. You can always create an element from the type, if needed. With a type, other elements can reuse that type. - <xs:all> specifies that the child elements can appear in any order. + <xsd:all> specifies that the child elements can appear in any order. - <xs:sequence> specifies child elements can only appear in the order mentioned. + <xsd:sequence> specifies child elements can only appear in the order mentioned. --> - <xs:simpleType name="parentEnumType"> - <xs:restriction base="xs:token"> - <xs:enumeration value="FIRST"/> - <xs:enumeration value="SECOND"/> - <xs:enumeration value="THIRD"/> - <xs:enumeration value="FOURTH"/> - <xs:enumeration value="FIVETH"/> - </xs:restriction> - </xs:simpleType> + <xsd:simpleType name="parentEnumType"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="FIRST"/> + <xsd:enumeration value="SECOND"/> + <xsd:enumeration value="THIRD"/> + <xsd:enumeration value="FOURTH"/> + <xsd:enumeration value="FIVETH"/> + </xsd:restriction> + </xsd:simpleType> - <xs:simpleType name="limitedString"> - <xs:restriction base="xs:string"> - <xs:maxLength value="30" /> - </xs:restriction> - </xs:simpleType> + <xsd:simpleType name="limitedString"> + <xsd:restriction base="xsd:string"> + <xsd:maxLength value="30" /> + </xsd:restriction> + </xsd:simpleType> - <xs:complexType name="element"> - <xs:sequence> - <xs:element name="message" type="xs:string"/> - <xs:element name="messageArgs" type="xs:string" minOccurs="0" maxOccurs="100"/> - </xs:sequence> - </xs:complexType> + <xsd:complexType name="element"> + <xsd:sequence> + <xsd:element name="message" type="xsd:string"/> + <xsd:element name="messageArgs" type="xsd:string" minOccurs="0" maxOccurs="100"/> + </xsd:sequence> + </xsd:complexType> - <xs:element name="GeneralFault"> - <xs:complexType> - <xs:sequence> - <xs:element name="technicalError" type="xs:string" /> - <xs:element name="elements" type="parent:element" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xs:complexType> - </xs:element> + <xsd:element name="GeneralFault"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="technicalError" type="xsd:string" /> + <xsd:element name="elements" type="element" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> -</xs:schema> +</xsd:schema> diff --git a/jaxb2/web-services-spring-jaxb2-server/src/main/build-resources/bindings/custombinding.xjb b/jaxb2/web-services-spring-jaxb2-server/src/main/build-resources/bindings/custombinding.xjb index 1363870..a7164c0 100644 --- a/jaxb2/web-services-spring-jaxb2-server/src/main/build-resources/bindings/custombinding.xjb +++ b/jaxb2/web-services-spring-jaxb2-server/src/main/build-resources/bindings/custombinding.xjb @@ -40,12 +40,12 @@ <!-- The same applies to annotate. If you do not want or you may not modify your xsd files you can modify instead this file with your custom binding :) --> - <!-- Custom xs:dateTime adapter + <!-- Custom xsd:dateTime adapter See: https://jaxb.java.net/2.2.4/docs/vendorCustomizations.html#javaType --> <jaxb:globalBindings> <xjc:javaType adapter="de.spring.webservices.binders.XSDateTimeCustomBinder" - name="java.util.Date" xmlType="xs:dateTime" /> + name="java.util.Date" xmlType="xsd:dateTime" /> </jaxb:globalBindings> </jaxb:bindings> diff --git a/jaxb2/web-services-spring-jaxb2-server/src/main/resources/schemas/examples.xsd b/jaxb2/web-services-spring-jaxb2-server/src/main/resources/schemas/examples.xsd index e419711..59cd317 100644 --- a/jaxb2/web-services-spring-jaxb2-server/src/main/resources/schemas/examples.xsd +++ b/jaxb2/web-services-spring-jaxb2-server/src/main/resources/schemas/examples.xsd @@ -1,29 +1,30 @@ <?xml version="1.0" encoding="UTF-8" ?> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" +<xsd:schema xmlns="http://gumartinm.name/spring-ws/example" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:parent="http://gumartinm.name/spring-ws/parent" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance" xmlns:annox="http://annox.dev.java.net" - xmlns:example="http://gumartinm.name/spring-ws/example" jaxb:version="2.1" jaxb:extensionBindingPrefixes="inheritance annox" + targetNamespace="http://gumartinm.name/spring-ws/example" elementFormDefault="qualified" - targetNamespace="http://gumartinm.name/spring-ws/example"> + attributeFormDefault="unqualified"> <!-- When should an item be declared as an element versus when should it be defined as a type? When in doubt, make it a type. You can always create an element from the type, if needed. With a type, other elements can reuse that type. - <xs:all> specifies that the child elements can appear in any order. + <xsd:all> specifies that the child elements can appear in any order. - <xs:sequence> specifies child elements can only appear in the order mentioned. + <xsd:sequence> specifies child elements can only appear in the order mentioned. --> <!-- We are going to use catalog.cat in order to avoid downloading parent.xsd from remote server when creating Java objects from examples.xsd. --> - <xs:import namespace="http://gumartinm.name/spring-ws/parent" schemaLocation="http://gumartinm.name/spring-ws/parent/parent.xsd" /> + <xsd:import namespace="http://gumartinm.name/spring-ws/parent" schemaLocation="http://gumartinm.name/spring-ws/parent/parent.xsd" /> <!-- Spring requires the following: @@ -37,90 +38,90 @@ The same for CustomBindingExample. --> <!-- Using inheritance and annox plugin --> - <xs:element name="ExampleRequest"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> + <xsd:element name="ExampleRequest"> + <xsd:complexType> + <xsd:annotation> + <xsd:appinfo> <annox:annotate>@java.lang.SuppressWarnings({"unchecked","rawtypes"})</annox:annotate> <inheritance:implements>de.spring.webservices.operations.Request</inheritance:implements> - </xs:appinfo> - </xs:annotation> - <xs:all> - <xs:element name="data" type="parent:limitedString" /> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="ExampleResponse"> - <xs:complexType> - <xs:annotation> - <xs:appinfo> + </xsd:appinfo> + </xsd:annotation> + <xsd:all> + <xsd:element name="data" type="parent:limitedString" /> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="ExampleResponse"> + <xsd:complexType> + <xsd:annotation> + <xsd:appinfo> <inheritance:implements>de.spring.webservices.operations.Response</inheritance:implements> - </xs:appinfo> - </xs:annotation> - <xs:all> - <xs:element name="data" type="xs:string" /> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="ExampleFault"> - <xs:complexType> - <xs:sequence> - <xs:element ref="parent:GeneralFault" /> - </xs:sequence> - </xs:complexType> - </xs:element> + </xsd:appinfo> + </xsd:annotation> + <xsd:all> + <xsd:element name="data" type="xsd:string" /> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="ExampleFault"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="parent:GeneralFault" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> <!-- Using custombinding.xjb instead of inheritance plugin. Useful when you can not modify your xsd files because they are provided by another person or company --> - <xs:element name="CustomBindingExampleRequest"> - <xs:complexType> - <xs:all> - <xs:element name="data" type="xs:string" /> - <xs:element name="exampleDate" type="xs:dateTime" minOccurs="0" maxOccurs="1" /> - <xs:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="CustomBindingExampleResponse"> - <xs:complexType> - <xs:all> - <xs:element name="data" type="xs:string" /> - <xs:element name="exampleDate" type="xs:dateTime" minOccurs="0" maxOccurs="1" /> - <xs:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> - </xs:all> - </xs:complexType> - </xs:element> - <xs:element name="CustomBindingExampleFault"> - <xs:complexType> - <xs:sequence> - <xs:element ref="parent:GeneralFault" /> - </xs:sequence> - </xs:complexType> - </xs:element> + <xsd:element name="CustomBindingExampleRequest"> + <xsd:complexType> + <xsd:all> + <xsd:element name="data" type="xsd:string" /> + <xsd:element name="exampleDate" type="xsd:dateTime" minOccurs="0" maxOccurs="1" /> + <xsd:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="CustomBindingExampleResponse"> + <xsd:complexType> + <xsd:all> + <xsd:element name="data" type="xsd:string" /> + <xsd:element name="exampleDate" type="xsd:dateTime" minOccurs="0" maxOccurs="1" /> + <xsd:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> + </xsd:all> + </xsd:complexType> + </xsd:element> + <xsd:element name="CustomBindingExampleFault"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="parent:GeneralFault" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> <!-- Example of creating array list by means of XSD --> - <xs:complexType name="car"> - <xs:sequence> - <xs:element name="data" type="xs:string" /> - <xs:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="100" /> - </xs:sequence> - </xs:complexType> - <xs:complexType name="truck"> - <xs:all> - <xs:element name="data" type="xs:string" /> - <xs:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> - </xs:all> - </xs:complexType> - <xs:element name="vehicles"> - <xs:complexType> - <xs:sequence> - <xs:element name="cars" type="example:car" maxOccurs="unbounded" /> - <xs:element name="trucks" type="example:truck" minOccurs="0" maxOccurs="100" /> - </xs:sequence> - </xs:complexType> - </xs:element> + <xsd:complexType name="car"> + <xsd:sequence> + <xsd:element name="data" type="xsd:string" /> + <xsd:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="truck"> + <xsd:all> + <xsd:element name="data" type="xsd:string" /> + <xsd:element name="parentEnum" type="parent:parentEnumType" minOccurs="0" maxOccurs="1" /> + </xsd:all> + </xsd:complexType> + <xsd:element name="vehicles"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="cars" type="car" maxOccurs="unbounded" /> + <xsd:element name="trucks" type="truck" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + </xsd:complexType> + </xsd:element> -</xs:schema> +</xsd:schema> -- 2.1.4