2015-02-05 107 views
0

我目前正在javaEE中開發一個jax-ws服務。一切工作正常,我能夠生成soapUI測試。但是當我訪問url中的wsdl時,它不顯示覆雜的類型定義。示例代碼如下:WSDL不包含複雜類型定義

@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; 

} 

我的另一個問題是如何生成的WSDL和其他屬性,如枚舉枚舉添加基數?上面的代碼應該產生類似於:

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

回答

0

找到了我的問題的答案。具有複雜類型的完整xsd實際上是自動生成的,但與通常不同,它是寫入wsdl文件導入的另一個文件中的,因此我的。因此在我的CustomerWS?wsdl文件中有一條導入聲明:

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

它包含完整的服務定義。