Question

Does anyone know what extra classes parameter from Java2WSDL tool mean?

Java2DSDL Reference

I am looking to answer this question, but have no success.

Was it helpful?

Solution

It is used to include those types in WSDL definition whose parents appears as return types or parameters. Consider very simple example:

public class DemoService {
    public Animal pickRandomAnimal() {
        return new Dog(); // or any other animal
    }
}

.. where Animal is an interface. At a WSDL generation time Axis2 will not be able to automatically trace all possible implementations of Animal that you might expect to be returned. Without extraClasses you'll get something like this:

    <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://demo.com/xsd">
        <xs:complexType name="Animal">
            <xs:sequence>
                <xs:element minOccurs="0" name="animalName" nillable="true" type="xs:string"/>
            </xs:sequence>
        </xs:complexType>
    </xs:schema>

.. and if you add extraClasses="com.demo.Dog", you'll cover all types you need in your WSDL schema part:

    <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://demo.com/xsd">
        <xs:complexType name="Animal">
            <xs:sequence>
                <xs:element minOccurs="0" name="animalName" nillable="true" type="xs:string"/>
            </xs:sequence>
        </xs:complexType>
        <xs:complexType name="Dog">
            <xs:sequence>
                <xs:element minOccurs="0" name="animalName" nillable="true" type="xs:string"/>
            </xs:sequence>
        </xs:complexType>
    </xs:schema>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top