Search code examples
web-serviceswsdlxsdcxfwsdl2java

Microsoft webservice and CXF client: JAXB fails to understand "s:schema"


I have ordinary Microsoft webservice and normal CXF of latest version with Java/JDK 1.6, Eclipse etc. When I am running wsdl2java, the JAXB part throws an error "Thrown by JAXB: undefined element declaration 's:schema' "

The part of WSDL which causes it looks like:

<s:element name="GetDepartmentsResponse">
 <s:complexType>
  <s:sequence>
   <s:element minOccurs="0" maxOccurs="1" name="GetDepartmentsResult">
    <s:complexType>
     <s:sequence>
      <s:element ref="s:schema" /> 
      <s:any /> 
     </s:sequence>
    </s:complexType>
   </s:element>
  </s:sequence>
 </s:complexType>
</s:element>

Can I simply remove <s:element ref="s:schema" /> everywhere and keep <s:any/> ? It looks like common obstacle for Java<->Microsoft webservices interoperability. But I can not find any workaround for CXF.


Solution

  • Usually you can remove the schema ref. You may need to change the <s:any> to <s:any maxOccurs="2"> or similar to make sure there is room for both the schema element and anything that follows it.