I do not know why but JAXB2 works better when XSD types end with the Type suffix
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Fri, 15 Jul 2016 18:54:36 +0000 (20:54 +0200)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Fri, 15 Jul 2016 18:54:36 +0000 (20:54 +0200)
SOAP/cxf/web-services-spring-cxf-client/src/main/build-resources/wsdl/example.wsdl
SOAP/cxf/web-services-spring-cxf-client/src/main/resources/examples.xsd
SOAP/cxf/web-services-spring-cxf-globalxsds/src/main/resources/parent.xsd
SOAP/cxf/web-services-spring-cxf-server/src/main/java/de/spring/webservices/endpoints/MyCustomMappingExceptionResolver.java
SOAP/cxf/web-services-spring-cxf-server/src/main/resources/examples.xsd
SOAP/jaxb2/web-services-spring-jaxb2-client/src/main/build-resources/wsdl/example.wsdl
SOAP/jaxb2/web-services-spring-jaxb2-client/src/main/resources/schemas/examples.xsd
SOAP/jaxb2/web-services-spring-jaxb2-globalxsds/src/main/resources/schemas/parent.xsd
SOAP/jaxb2/web-services-spring-jaxb2-server/src/main/java/de/spring/webservices/endpoints/MyCustomMappingExceptionResolver.java
SOAP/jaxb2/web-services-spring-jaxb2-server/src/main/resources/schemas/examples.xsd

index e3f61ed..ff364f5 100644 (file)
@@ -38,7 +38,7 @@
                 </xsd:appinfo>
             </xsd:annotation>   
             <xsd:all>
-                <xsd:element name="data" type="parent:limitedString"/>
+                <xsd:element name="data" type="parent:limitedStringType"/>
             </xsd:all>
         </xsd:complexType>
        </xsd:element>
       <soap12:address location="http://localhost:8080/web-services-spring-cxf-server/spring-ws/example"/>
     </wsdl:port>
   </wsdl:service>
-</wsdl:definitions>
\ No newline at end of file
+</wsdl:definitions>
index 59cd317..73d9a8c 100644 (file)
@@ -47,7 +47,7 @@
                 </xsd:appinfo>
             </xsd:annotation>   
             <xsd:all>
-                <xsd:element name="data" type="parent:limitedString" />
+                <xsd:element name="data" type="parent:limitedStringType" />
             </xsd:all>
         </xsd:complexType>
        </xsd:element>
index b38ca36..f33c496 100644 (file)
@@ -14,6 +14,7 @@
          <xsd:sequence> specifies child elements can only appear in the order mentioned.
     -->
        
+       <!-- WARNING: I DO NOT KNOW WHY BUT TYPES WORK BETTER WITH JAXB IF THEY END WITH THE Type SUFFIX!!!! :/ -->
     <xsd:simpleType name="parentEnumType">
         <xsd:restriction base="xsd:token">
             <xsd:enumeration value="FIRST"/>
         </xsd:restriction>
     </xsd:simpleType>
     
-    <xsd:simpleType name="limitedString">
+    <!-- WARNING: I DO NOT KNOW WHY BUT TYPES WORK BETTER WITH JAXB IF THEY END WITH THE Type SUFFIX!!!! :/ --> 
+    <xsd:simpleType name="limitedStringType">
        <xsd:restriction base="xsd:string">
                <xsd:maxLength value="30" />
        </xsd:restriction>
        </xsd:simpleType>
        
-       <xsd:complexType name="element">
+       <!-- WARNING: I DO NOT KNOW WHY BUT TYPES WORK BETTER WITH JAXB IF THEY END WITH THE Type SUFFIX!!!! :/ -->
+       <xsd:complexType name="elementType">
         <xsd:sequence>
             <xsd:element name="message" type="xsd:string"/>
             <xsd:element name="messageArgs" type="xsd:string" minOccurs="0" maxOccurs="100"/>
         </xsd:sequence>
     </xsd:complexType>
     
-    <xsd:element name="GeneralFault">
+    <xsd:element id="GeneralFault" name="GeneralFault">
        <xsd:complexType>
                <xsd:sequence>
                        <xsd:element name="technicalError" type="xsd:string" />
-                       <xsd:element name="elements" type="element" minOccurs="0" maxOccurs="unbounded"/>
+                       <xsd:element name="elements" type="elementType" minOccurs="0" maxOccurs="unbounded"/>
                </xsd:sequence>
        </xsd:complexType>
     </xsd:element>
index 9d05061..01d80ab 100644 (file)
@@ -20,8 +20,8 @@ import org.springframework.ws.soap.server.endpoint.SoapFaultDefinition;
 import org.springframework.ws.soap.server.endpoint.SoapFaultDefinitionEditor;
 
 import de.spring.webservices.exceptions.CustomBusinessException;
-import de.spring.webservices.server.auto.Element;
-import de.spring.webservices.server.auto.GeneralFault;
+import de.spring.webservices.parent.auto.ElementType;
+import de.spring.webservices.parent.auto.GeneralFault;
 
 public class MyCustomMappingExceptionResolver extends AbstractSoapFaultDefinitionExceptionResolver {
        private static final Logger LOGGER = LoggerFactory.getLogger(MyCustomMappingExceptionResolver.class);
@@ -97,8 +97,8 @@ public class MyCustomMappingExceptionResolver extends AbstractSoapFaultDefinitio
                GeneralFault customFault = new GeneralFault();
                customFault.setTechnicalError(getStackTrace(ex));
                
-               Element element = buildElement(ex);
-               List<Element> elements = customFault.getElements();
+               ElementType element = buildElement(ex);
+               List<ElementType> elements = customFault.getElements();
                elements.add(element);
                
                SoapFaultDetail detail = fault.addFaultDetail();
@@ -114,8 +114,8 @@ public class MyCustomMappingExceptionResolver extends AbstractSoapFaultDefinitio
                this.marshaller = marshaller;
        }
                
-       private Element buildElement(Exception ex) {
-               Element element = new Element();
+       private ElementType buildElement(Exception ex) {
+               ElementType element = new ElementType();
                element.setMessage(ex.getMessage());
                
                if (ex instanceof CustomBusinessException) {
index 59cd317..73d9a8c 100644 (file)
@@ -47,7 +47,7 @@
                 </xsd:appinfo>
             </xsd:annotation>   
             <xsd:all>
-                <xsd:element name="data" type="parent:limitedString" />
+                <xsd:element name="data" type="parent:limitedStringType" />
             </xsd:all>
         </xsd:complexType>
        </xsd:element>
index 202d87b..140de62 100644 (file)
@@ -38,7 +38,7 @@
                 </xsd:appinfo>
             </xsd:annotation>   
             <xsd:all>
-                <xsd:element name="data" type="parent:limitedString"/>
+                <xsd:element name="data" type="parent:limitedStringType"/>
             </xsd:all>
         </xsd:complexType>
        </xsd:element>
index 59cd317..73d9a8c 100644 (file)
@@ -47,7 +47,7 @@
                 </xsd:appinfo>
             </xsd:annotation>   
             <xsd:all>
-                <xsd:element name="data" type="parent:limitedString" />
+                <xsd:element name="data" type="parent:limitedStringType" />
             </xsd:all>
         </xsd:complexType>
        </xsd:element>
index b38ca36..f33c496 100644 (file)
@@ -14,6 +14,7 @@
          <xsd:sequence> specifies child elements can only appear in the order mentioned.
     -->
        
+       <!-- WARNING: I DO NOT KNOW WHY BUT TYPES WORK BETTER WITH JAXB IF THEY END WITH THE Type SUFFIX!!!! :/ -->
     <xsd:simpleType name="parentEnumType">
         <xsd:restriction base="xsd:token">
             <xsd:enumeration value="FIRST"/>
         </xsd:restriction>
     </xsd:simpleType>
     
-    <xsd:simpleType name="limitedString">
+    <!-- WARNING: I DO NOT KNOW WHY BUT TYPES WORK BETTER WITH JAXB IF THEY END WITH THE Type SUFFIX!!!! :/ --> 
+    <xsd:simpleType name="limitedStringType">
        <xsd:restriction base="xsd:string">
                <xsd:maxLength value="30" />
        </xsd:restriction>
        </xsd:simpleType>
        
-       <xsd:complexType name="element">
+       <!-- WARNING: I DO NOT KNOW WHY BUT TYPES WORK BETTER WITH JAXB IF THEY END WITH THE Type SUFFIX!!!! :/ -->
+       <xsd:complexType name="elementType">
         <xsd:sequence>
             <xsd:element name="message" type="xsd:string"/>
             <xsd:element name="messageArgs" type="xsd:string" minOccurs="0" maxOccurs="100"/>
         </xsd:sequence>
     </xsd:complexType>
     
-    <xsd:element name="GeneralFault">
+    <xsd:element id="GeneralFault" name="GeneralFault">
        <xsd:complexType>
                <xsd:sequence>
                        <xsd:element name="technicalError" type="xsd:string" />
-                       <xsd:element name="elements" type="element" minOccurs="0" maxOccurs="unbounded"/>
+                       <xsd:element name="elements" type="elementType" minOccurs="0" maxOccurs="unbounded"/>
                </xsd:sequence>
        </xsd:complexType>
     </xsd:element>
index 382cd74..01d80ab 100644 (file)
@@ -20,7 +20,7 @@ import org.springframework.ws.soap.server.endpoint.SoapFaultDefinition;
 import org.springframework.ws.soap.server.endpoint.SoapFaultDefinitionEditor;
 
 import de.spring.webservices.exceptions.CustomBusinessException;
-import de.spring.webservices.parent.auto.Element;
+import de.spring.webservices.parent.auto.ElementType;
 import de.spring.webservices.parent.auto.GeneralFault;
 
 public class MyCustomMappingExceptionResolver extends AbstractSoapFaultDefinitionExceptionResolver {
@@ -97,8 +97,8 @@ public class MyCustomMappingExceptionResolver extends AbstractSoapFaultDefinitio
                GeneralFault customFault = new GeneralFault();
                customFault.setTechnicalError(getStackTrace(ex));
                
-               Element element = buildElement(ex);
-               List<Element> elements = customFault.getElements();
+               ElementType element = buildElement(ex);
+               List<ElementType> elements = customFault.getElements();
                elements.add(element);
                
                SoapFaultDetail detail = fault.addFaultDetail();
@@ -114,8 +114,8 @@ public class MyCustomMappingExceptionResolver extends AbstractSoapFaultDefinitio
                this.marshaller = marshaller;
        }
                
-       private Element buildElement(Exception ex) {
-               Element element = new Element();
+       private ElementType buildElement(Exception ex) {
+               ElementType element = new ElementType();
                element.setMessage(ex.getMessage());
                
                if (ex instanceof CustomBusinessException) {
index 59cd317..73d9a8c 100644 (file)
@@ -47,7 +47,7 @@
                 </xsd:appinfo>
             </xsd:annotation>   
             <xsd:all>
-                <xsd:element name="data" type="parent:limitedString" />
+                <xsd:element name="data" type="parent:limitedStringType" />
             </xsd:all>
         </xsd:complexType>
        </xsd:element>