【问题标题】:WSDL doesn't contain complex types definitionWSDL 不包含复杂类型定义
【发布时间】:2015-02-05 03:24:40
【问题描述】:

我目前正在 javaEE 中开发一个 jax-ws 服务。一切正常,我能够生成soapUI测试。但是当我访问 url 中的 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"/>
        ...

【问题讨论】:

    标签: jakarta-ee soap jax-ws java-ee-6


    【解决方案1】:

    找到了我的问题的答案。具有复杂类型的完整 xsd 确实是自动生成的,但与通常不同的是,它写入在 wsdl 文件中导入的另一个文件上,所以 my.所以在我的 CustomerWS?wsdl 文件中有一个导入语句:

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

    它包含完整的服务定义。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-12-18
      • 2018-06-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-19
      • 1970-01-01
      相关资源
      最近更新 更多