Search code examples
javaxmlweb-servicesxsdwsdl

Generate WSDL with XSD schema from JAX-WS


I have a JAX-WS annotated Webservice, and when I deploy it into a WildFly 8.1.0 Final I have something like this:

<wsdl:types>
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://www.viactt.pt" targetNamespace="http://www.viactt.pt" version="1.0">
    <xs:import namespace="http://www.viactt.pt"/>
    <xs:element name="wsAccountArray" type="ns1:wsAccountArray"/>
  </xs:schema>
</wsdl:types>

when what I want is something like this:

<wsdl:types>
  <xsd:schema>
    <xsd:import namespace="http://www.viactt.pt" schemaLocation="ViaCTTIntegrationService_schema1.xsd"/>
  </xsd:schema>
</wsdl:types>

So, basically, I want the WildFly/JAX-WS to put some types in a separate XSD schema file instead of just showing them in the WSDL file.

Can I do this via some annotation or via some configuration file?


Solution

  • Us XJC plugin of maven(maven-jaxb2-plugin) to re-generate the JAXB object from wsdl . Click Here for the Tutorial. You can also see . One more blog is having complete tutorial of it. Click Here to see.