[ERROR] 无法生成 SEI, 类已存在。请使用 JAX-WS 定制设置重命名 wsdl:portType

问题说明

  1. 在使用idea的Tools>WebServices>Generate Wsdl From Java Code…生成WebService客户端时发生了 [ERROR] 无法生成 SEI, 类已存在。请使用 JAX-WS 定制设置重命名 wsdl:portType
    在这里插入图片描述

  2. 然后我就使用命令行的方式生成WebService客户端,报错信息一致
    wsimport -keep -verbose -encoding utf-8 -s . http://127.0.0.1:8088/services/woIssueReceiveService?wsdl -p com.superlighting.imes.webclient.common.wms.item.receive -B-XautoNameResolution
    在这里插入图片描述

  3. 我的WSDL文件如下

<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://wms.hzero.org" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="woIssueReceiveService" targetNamespace="http://test.com.org">
  <wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://wms.hzero.org" elementFormDefault="unqualified" targetNamespace="http://wms.hzero.org" version="1.0">

  <xs:element name="woIssueReceiveResponseDTO" type="tns:data"/>

  <xs:element name="woIssueReceiveService" type="tns:woIssueReceiveService"/>

  <xs:element name="woIssueReceiveServiceResponse" type="tns:woIssueReceiveServiceResponse"/>

  <xs:complexType name="woIssueReceiveService">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="WOIssueReceiveDTO" type="tns:woIssueReceiveDTO"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="woIssueReceiveDTO">
    <xs:sequence>
      <xs:element minOccurs="0" name="containerCode" type="xs:string"/>
      <xs:element minOccurs="0" name="personId" type="xs:string"/>
      <xs:element minOccurs="0" name="prodLineCode" type="xs:string"/>
      <xs:element minOccurs="0" name="siteCode" type="xs:string"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="woIssueReceiveLineDTOList" nillable="true" type="tns:woIssueReceiveLineDTO"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="woIssueReceiveLineDTO">
    <xs:sequence>
      <xs:element minOccurs="0" name="acceptationIdetification" type="xs:string"/>
      <xs:element minOccurs="0" name="instructionDocNum" type="xs:string"/>
      <xs:element minOccurs="0" name="materialLotCode" type="xs:string"/>
      <xs:element minOccurs="0" name="taskHeadNum" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="woIssueReceiveServiceResponse">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="WOIssueReceiveResponseDTO" type="tns:data"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="data">
    <xs:sequence>
      <xs:element minOccurs="0" name="code" type="xs:string"/>
      <xs:element minOccurs="0" name="message" type="xs:string"/>
      <xs:element minOccurs="0" name="status" type="xs:boolean"/>
    </xs:sequence>
  </xs:complexType>

</xs:schema>
  </wsdl:types>
  <wsdl:message name="woIssueReceiveService">
    <wsdl:part element="tns:woIssueReceiveService" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="woIssueReceiveServiceResponse">
    <wsdl:part element="tns:woIssueReceiveServiceResponse" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="WOIssueReceiveService">
    <wsdl:operation name="woIssueReceiveService">
      <wsdl:input message="tns:woIssueReceiveService" name="woIssueReceiveService">
    </wsdl:input>
      <wsdl:output message="tns:woIssueReceiveServiceResponse" name="woIssueReceiveServiceResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="woIssueReceiveServiceSoapBinding" type="tns:WOIssueReceiveService">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="woIssueReceiveService">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="woIssueReceiveService">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="woIssueReceiveServiceResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="woIssueReceiveService">
    <wsdl:port binding="tns:woIssueReceiveServiceSoapBinding" name="WOIssueReceiveServiceImpPort">
      <soap:address location="http://127.0.0.1:8088/services/woIssueReceiveService"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

解决方法

  1. 创建v2.xml文件
<bindings 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    wsdlLocation="http://1127.0.0.1:8088/services/woIssueReceiveService?wsdl"
    xmlns="http://java.sun.com/xml/ns/jaxws">
    <package name="com.superlighting.imes.webclient.common.wms.item.receive"/>
    <!-- default settings -->
    <enableWrapperStyle>true</enableWrapperStyle>
    <enableAsyncMapping>false</enableAsyncMapping>
    <!-- wsdl:portType customization -->
    <bindings node="wsdl:definitions/wsdl:portType[@name='WOIssueReceiveService']">
        <!-- change the generated SEI class -->
        <class name="woIssueReceiveServiceV2"/>
        <!-- you can also override the following customization settings -->
        <enableWrapperStyle>true</enableWrapperStyle>
        <enableAsyncMapping>false</enableAsyncMapping>
    </bindings>
</bindings>
  1. 添加-b 命令添加指定 jaxws/jaxb 绑定文件或附加模式 (每个 都必须具有自己的 -b)
    wsimport -keep -verbose -encoding utf-8 -s . http://127.0.0.1:8088/services/woIssueReceiveService?wsdl -p com.superlighting.imes.webclient.common.wms.item.receive -b D:\first\wsimport\bind\v2.xml -B-XautoNameResolution
  2. 生成成功
    在这里插入图片描述

参考:

  1. wsimport [ERROR] 无法生成 SEI, 类com.xx.XX 已存在
  2. Rename WSDL elements with identical names using a JAX-WS binding customization
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值