Search code examples
jakarta-eesoapjax-wsjava-ee-6

WSDL doesn't contain complex types definition


I'm currently developing a jax-ws service in javaEE. Everything is working correctly, I was able to generate soapUI tests. But when I access the wsdl in the url it doesn't show the complex type definitions. Sample code as follows:

@WebService
public interface AccountWs {

    @WebMethod
    ActionStatus createCustomer(@WebParam(name = "customer") CustomerDto postData);

}

@WebService(serviceName = "AccountWs", endpointInterface = "org.xxx.api.ws.AccountWs")
public class AccountWsImpl implements AccountWs {

    @Override
    public ActionStatus createCustomer(CustomerDto postData) {
    }

}   

@XmlRootElement(name = "Customer")
@XmlAccessorType(XmlAccessType.FIELD)
public class CustomerDto {

    private String code;

}

My other question is how to add cardinality in the generated wsdl and other properties such as enum enumeration? The above code should generate something like:

<xsd:complexType name="CustomerDto">
    <xsd:sequence>
        <xsd:element minOccurs="0" name="code" nillable="true" type="xsd:string"/>
        ...

Solution

  • Found the answer to my question. The full xsd with complex types was indeed auto-generated but unlike the usual it's written on another file imported on the wsdl file so my. So in my CustomerWS?wsdl file there is an import statement:

    <wsdl:import location="http://xxx/Customer?wsdl=Customer.wsdl" namespace="http://ws.api.meveo.org/">
    </wsdl:import>
    

    And it contains the complete service definition.