Search code examples
javasoapwsdljax-wsapache-axis

Delegate Axis2 WSDL generation to the JAX-WS RI?


I have a very simple JAX-WS + JAXB SOAP service that I am, by nature of my employment, forced to deploy via Axis2.

If I take my JAXB classes and my service class, and deploy them via the JAX-WS reference implementation baked into the JDK, e.g.

public static void main(final String... args) {
    Endpoint.publish("http://0.0.0.0:9090/MyService", new MyService());
}

The RI (2.2.4, JDK7) generates a beautiful, standards-compliant WSDL that can be consumed by pretty much any tool (soapUI, etc.).


If I take the very same classes and deploy them via a services.xml file in Axis2, e.g.

<service name="MyService" scope="soapsession" targetNamespace="http://com.service.my">
    <Description>My Service Endpoint</Description>
    <messageReceivers>
        <messageReceiver class="org.apache.axis2.jaxws.server.JAXWSMessageReceiver" mep="http://www.w3.org/2004/08/wsdl/in-out"/>
    </messageReceivers>
    <!-- <parameter name="useOriginalwsdl">true</parameter> -->
    <parameter locked="false" name="ServiceClass">com.service.my.MyService</parameter>
</service>

Axis2's WSDL generation takes over and generates complete garbage that's unusable by pretty much any tooling.

I know that I can uncomment the <parameter name="useOriginalwsdl">true</parameter> line in my services.xml and provide a static WSDL, but doing so forces me to keep the WSDL updated manually in the future, which I would prefer to avoid.

Is there any way to deploy my service via Axis2 and have the WSDL generated, but circumvent Axis2's abysmal WSDL generation and delegate that to the JAX-WS RI?


Solution

  • It turns out that this is not possible without modifying or hooking into Axis2's implementation, which obviously creates a maintenance problem later on. As such, I guess I will just live with the crappy WSDLs that Axis2 generates.