【问题标题】:java + Consuming a SOAP web service + "Two classes Have the same XML type name ..."java + 使用 SOAP Web 服务 + “两个类具有相同的 XML 类型名称......”
【发布时间】:2016-03-30 02:52:23
【问题描述】:

我正在尝试使用 java 使用一个肥皂网络服务。

我有以下 WSDL 的“wsimport”生成的类:

 <?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="RepositorioXDS" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="adocumentrepository_servicesService" targetNamespace="RepositorioXDS">
  <wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0" xmlns:ns1="RepositorioXDS" targetNamespace="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0" version="1.0">

  <xs:import namespace="RepositorioXDS"/>

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

  <xs:complexType final="extension restriction" name="RegistryErrorList">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" minOccurs="0" ref="ns1:RegistryError"/>
    </xs:sequence>
    <xs:attribute name="highestSeverity" type="xs:string"/>
  </xs:complexType>

  <xs:complexType final="extension restriction" name="RegistryError">
    <xs:sequence/>
    <xs:attribute name="codeContext" type="xs:string"/>
    <xs:attribute name="errorCode" type="xs:string"/>
    <xs:attribute name="location" type="xs:string"/>
    <xs:attribute name="severity" type="xs:string"/>
  </xs:complexType>

</xs:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0" xmlns:ns1="RepositorioXDS" targetNamespace="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0" version="1.0">

  <xs:import namespace="RepositorioXDS"/>

  <xs:complexType final="extension restriction" name="AssociationType1">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="Slot" type="tns:SlotType1"/>
    </xs:sequence>
    <xs:attribute name="associationType" type="xs:string"/>
    <xs:attribute name="home" type="xs:string"/>
    <xs:attribute name="id" type="xs:string"/>
    <xs:attribute name="lid" type="xs:string"/>
    <xs:attribute name="objectType" type="xs:string"/>
    <xs:attribute name="sourceObject" type="xs:string"/>
    <xs:attribute name="status" type="xs:string"/>
    <xs:attribute name="targetObject" type="xs:string"/>
  </xs:complexType>

  <xs:complexType final="extension restriction" name="SlotType1">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="Value" type="xs:string"/>
    </xs:sequence>
    <xs:attribute name="name" type="xs:string"/>
    <xs:attribute name="slotType" type="xs:string"/>
  </xs:complexType>

  <xs:complexType final="extension restriction" name="ClassificationType">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="Name" type="tns:LocalizedStringType"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="Slot" type="tns:SlotType1"/>
    </xs:sequence>
    <xs:attribute name="classificationNode" type="xs:string"/>
    <xs:attribute name="classificationScheme" type="xs:string"/>
    <xs:attribute name="classifiedObject" type="xs:string"/>
    <xs:attribute name="home" type="xs:string"/>
    <xs:attribute name="id" type="xs:string"/>
    <xs:attribute name="lid" type="xs:string"/>
    <xs:attribute name="nodeRepresentation" type="xs:string"/>
    <xs:attribute name="objectType" type="xs:string"/>
    <xs:attribute name="status" type="xs:string"/>
  </xs:complexType>

  <xs:complexType final="extension restriction" name="LocalizedStringType">
    <xs:sequence/>
    <xs:attribute name="charset" type="xs:string"/>
    <xs:attribute name="lang" type="xs:string"/>
    <xs:attribute name="value" type="xs:string"/>
  </xs:complexType>

  <xs:complexType final="extension restriction" name="ExternalIdentifierType">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="Name" type="tns:LocalizedStringType"/>
    </xs:sequence>
    <xs:attribute name="home" type="xs:string"/>
    <xs:attribute name="id" type="xs:string"/>
    <xs:attribute name="identificationScheme" type="xs:string"/>
    <xs:attribute name="lid" type="xs:string"/>
    <xs:attribute name="objectType" type="xs:string"/>
    <xs:attribute name="registryObject" type="xs:string"/>
    <xs:attribute name="status" type="xs:string"/>
    <xs:attribute name="value" type="xs:string"/>
  </xs:complexType>

</xs:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:ihe:iti:xds-b:2007" version="1.0">

  <xs:complexType final="extension restriction" name="RetrieveDocumentSetRequestType.DocumentRequest">
    <xs:sequence>
      <xs:element form="qualified" minOccurs="0" name="DocumentUniqueId" type="xs:string"/>
      <xs:element form="qualified" minOccurs="0" name="HomeCommunityId" type="xs:string"/>
      <xs:element form="qualified" minOccurs="0" name="RepositoryUniqueId" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType final="extension restriction" name="RetrieveDocumentSetResponseType.DocumentResponse">
    <xs:sequence>
      <xs:element form="qualified" minOccurs="0" name="Document" type="xs:string"/>
      <xs:element form="qualified" minOccurs="0" name="DocumentUniqueId" type="xs:string"/>
      <xs:element form="qualified" minOccurs="0" name="HomeCommunityId" type="xs:string"/>
      <xs:element form="qualified" minOccurs="0" name="mimeType" type="xs:string"/>
      <xs:element form="qualified" minOccurs="0" name="RepositoryUniqueId" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>

</xs:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="RepositorioXDS" xmlns:ns3="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0" xmlns:ns2="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0" xmlns:ns1="urn:ihe:iti:xds-b:2007" elementFormDefault="unqualified" targetNamespace="RepositorioXDS" version="1.0">

  <xs:import namespace="urn:ihe:iti:xds-b:2007"/>

  <xs:import namespace="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0"/>

  <xs:import namespace="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0"/>

  <xs:element name="AssociationType1" type="ns2:AssociationType1"/>

  <xs:element name="ClassificationType" type="ns2:ClassificationType"/>

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

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

  <xs:element name="ExternalIdentifierType" type="ns2:ExternalIdentifierType"/>

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

  <xs:element name="LocalizedStringType" type="ns2:LocalizedStringType"/>

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

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

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

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

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

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

  <xs:element name="RegistryError" type="ns3:RegistryError"/>

  <xs:element name="RegistryErrorList" type="ns3:RegistryErrorList"/>

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

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

  <xs:element name="RetrieveDocumentSetRequestType.DocumentRequest" type="ns1:RetrieveDocumentSetRequestType.DocumentRequest"/>

  <xs:element name="RetrieveDocumentSetResponseType.DocumentResponse" type="ns1:RetrieveDocumentSetResponseType.DocumentResponse"/>

  <xs:element name="SlotType1" type="ns2:SlotType1"/>

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

  <xs:element name="SubmitObjectsRequest.RegistryObjectList" type="tns:SubmitObjectsRequest.RegistryObjectList"/>

  <xs:complexType name="RETRIEVEDOCUMENTSET">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="Retrievedocumentsetrequest" type="ns1:RetrieveDocumentSetRequestType.DocumentRequest"/>
    </xs:sequence>
  </xs:complexType>


  <xs:complexType name="RETRIEVEDOCUMENTSETResponse">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="Retrievedocumentsetresponse" type="ns1:RetrieveDocumentSetResponseType.DocumentResponse"/>
    </xs:sequence>
  </xs:complexType>


  <xs:complexType name="PROVIDEANDREGISTERDOCUMENTSET">
    <xs:sequence>
      <xs:element minOccurs="0" name="Submitobjectsrequest" type="tns:SubmitObjectsRequest"/>
      <xs:element minOccurs="0" name="Documentsrequest" type="tns:DocumentsRequest"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType final="extension restriction" name="SubmitObjectsRequest">
    <xs:sequence>
      <xs:element minOccurs="0" name="RegistryObjectList" type="tns:SubmitObjectsRequest.RegistryObjectList"/>
    </xs:sequence>
    <xs:attribute name="comment" type="xs:string"/>
    <xs:attribute name="id" type="xs:string"/>
  </xs:complexType>

  <xs:complexType final="extension restriction" name="SubmitObjectsRequest.RegistryObjectList">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="Association" type="ns2:AssociationType1"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="Classification" type="ns2:ClassificationType"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="ExtrinsicObject" type="tns:ExtrinsicObjectType"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="RegistryPackage" type="tns:RegistryPackageType"/>
    </xs:sequence>
  </xs:complexType>





  <xs:complexType final="extension restriction" name="ExtrinsicObjectType">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="Classification" type="ns2:ClassificationType"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="Description" type="ns2:LocalizedStringType"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="ExternalIdentifier" type="ns2:ExternalIdentifierType"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="Name" type="ns2:LocalizedStringType"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="Slot" type="ns2:SlotType1"/>
    </xs:sequence>
    <xs:attribute name="home" type="xs:string"/>
    <xs:attribute name="id" type="xs:string"/>
    <xs:attribute name="isOpaque" type="xs:boolean" use="required"/>
    <xs:attribute name="lid" type="xs:string"/>
    <xs:attribute name="mimeType" type="xs:string"/>
    <xs:attribute name="objectType" type="xs:string"/>
    <xs:attribute name="status" type="xs:string"/>
  </xs:complexType>


  <xs:complexType final="extension restriction" name="RegistryPackageType">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="Classification" type="ns2:ClassificationType"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="ExternalIdentifier" type="ns2:ExternalIdentifierType"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="LocalizedString" type="ns2:LocalizedStringType"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="Name" type="ns2:LocalizedStringType"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="Slot" type="ns2:SlotType1"/>
    </xs:sequence>
    <xs:attribute name="home" type="xs:string"/>
    <xs:attribute name="id" type="xs:string"/>
    <xs:attribute name="lid" type="xs:string"/>
    <xs:attribute name="objectType" type="xs:string"/>
    <xs:attribute name="status" type="xs:string"/>
  </xs:complexType>

  <xs:complexType final="extension restriction" name="DocumentsRequest">
    <xs:sequence>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="Document" type="tns:DocumentType"/>
    </xs:sequence>
    <xs:attribute name="dummy" type="xs:string"/>
  </xs:complexType>

  <xs:complexType final="extension restriction" name="DocumentType">
    <xs:sequence>
      <xs:element minOccurs="0" name="data" type="xs:string"/>
    </xs:sequence>
    <xs:attribute name="id" type="xs:string"/>
  </xs:complexType>

  <xs:complexType name="PROVIDEANDREGISTERDOCUMENTSETResponse">
    <xs:sequence>
      <xs:element minOccurs="0" name="Registryresponse" type="tns:RegistryResponseType"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType final="extension restriction" name="RegistryResponseType">
    <xs:sequence>
      <xs:element minOccurs="0" ref="tns:RegistryErrorList"/>
      <xs:element maxOccurs="unbounded" minOccurs="0" name="Slot" type="ns2:SlotType1"/>
    </xs:sequence>
    <xs:attribute name="requestId" type="xs:string"/>
    <xs:attribute name="status" type="xs:string"/>
  </xs:complexType>



  <xs:complexType name="PING">
    <xs:sequence/>
  </xs:complexType>

  <xs:complexType name="PINGResponse">
    <xs:sequence>
      <xs:element minOccurs="0" name="Pingresult" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>

</xs:schema>
  </wsdl:types>
  <wsdl:message name="PROVIDEANDREGISTERDOCUMENTSETResponse">
    <wsdl:part element="tns:PROVIDEANDREGISTERDOCUMENTSETResponse" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="RETRIEVEDOCUMENTSET">
    <wsdl:part element="tns:RETRIEVEDOCUMENTSET" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="RETRIEVEDOCUMENTSETResponse">
    <wsdl:part element="tns:RETRIEVEDOCUMENTSETResponse" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="PINGResponse">
    <wsdl:part element="tns:PINGResponse" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="PROVIDEANDREGISTERDOCUMENTSET">
    <wsdl:part element="tns:PROVIDEANDREGISTERDOCUMENTSET" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="PING">
    <wsdl:part element="tns:PING" name="parameters">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="adocumentrepository">
    <wsdl:operation name="RETRIEVEDOCUMENTSET">
      <wsdl:input message="tns:RETRIEVEDOCUMENTSET" name="RETRIEVEDOCUMENTSET">
    </wsdl:input>
      <wsdl:output message="tns:RETRIEVEDOCUMENTSETResponse" name="RETRIEVEDOCUMENTSETResponse">
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="PROVIDEANDREGISTERDOCUMENTSET">
      <wsdl:input message="tns:PROVIDEANDREGISTERDOCUMENTSET" name="PROVIDEANDREGISTERDOCUMENTSET">
    </wsdl:input>
      <wsdl:output message="tns:PROVIDEANDREGISTERDOCUMENTSETResponse" name="PROVIDEANDREGISTERDOCUMENTSETResponse">
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="PING">
      <wsdl:input message="tns:PING" name="PING">
    </wsdl:input>
      <wsdl:output message="tns:PINGResponse" name="PINGResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="adocumentrepository_servicesServiceSoapBinding" type="tns:adocumentrepository">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="RETRIEVEDOCUMENTSET">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="RETRIEVEDOCUMENTSET">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="RETRIEVEDOCUMENTSETResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="PROVIDEANDREGISTERDOCUMENTSET">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="PROVIDEANDREGISTERDOCUMENTSET">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="PROVIDEANDREGISTERDOCUMENTSETResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="PING">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="PING">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="PINGResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="adocumentrepository_servicesService">
    <wsdl:port binding="tns:adocumentrepository_servicesServiceSoapBinding" name="adocumentrepositoryPort">
      <soap:address location="http://192.168.1.42:8330/RepositorioXDS/adocumentrepository_services"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

我正在按如下方式初始化服务:

QName qName = new QName("RepositorioXDS", "adocumentrepository_servicesService");
URL url = new URL("file:///opt/adocumentrepository_services.xml");
AdocumentrepositoryServicesService service = new AdocumentrepositoryServicesService(url, qName);
Adocumentrepository port = service.getAdocumentrepositoryPort();

在制作 service.getAdocumentrepositoryPort() 时,我得到以下 exepcion:

...    
Caused by: java.security.PrivilegedActionException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 6 counts of IllegalAnnotationExceptions
Hay dos clases que tienen el mismo nombre de tipo XML "{RepositorioXDS}RETRIEVEDOCUMENTSET". Utilice @XmlType.name y @XmlType.namespace para asignarles nombres diferentes.
    this problem is related to the following location:
        at simic.soap.generated.repositorio.repositorioxds.RETRIEVEDOCUMENTSET
        at public simic.soap.generated.repositorio.repositorioxds.RETRIEVEDOCUMENTSET simic.soap.generated.repositorio.repositorioxds.ObjectFactory.createRETRIEVEDOCUMENTSET()
        at simic.soap.generated.repositorio.repositorioxds.ObjectFactory
    this problem is related to the following location:
        at repositorioxds.RETRIEVEDOCUMENTSET
Hay dos clases que tienen el mismo nombre de tipo XML "{RepositorioXDS}RETRIEVEDOCUMENTSETResponse". Utilice @XmlType.name y @XmlType.namespace para asignarles nombres diferentes.
    this problem is related to the following location:
        at simic.soap.generated.repositorio.repositorioxds.RETRIEVEDOCUMENTSETResponse
        at public simic.soap.generated.repositorio.repositorioxds.RETRIEVEDOCUMENTSETResponse simic.soap.generated.repositorio.repositorioxds.ObjectFactory.createRETRIEVEDOCUMENTSETResponse()
        at simic.soap.generated.repositorio.repositorioxds.ObjectFactory
    this problem is related to the following location:
        at repositorioxds.RETRIEVEDOCUMENTSETResponse
Hay dos clases que tienen el mismo nombre de tipo XML "{RepositorioXDS}PROVIDEANDREGISTERDOCUMENTSET". Utilice @XmlType.name y @XmlType.namespace para asignarles nombres diferentes.
    this problem is related to the following location:
        at simic.soap.generated.repositorio.repositorioxds.PROVIDEANDREGISTERDOCUMENTSET
        at public simic.soap.generated.repositorio.repositorioxds.PROVIDEANDREGISTERDOCUMENTSET simic.soap.generated.repositorio.repositorioxds.ObjectFactory.createPROVIDEANDREGISTERDOCUMENTSET()
        at simic.soap.generated.repositorio.repositorioxds.ObjectFactory
    this problem is related to the following location:
        at repositorioxds.PROVIDEANDREGISTERDOCUMENTSET
Hay dos clases que tienen el mismo nombre de tipo XML "{RepositorioXDS}PROVIDEANDREGISTERDOCUMENTSETResponse". Utilice @XmlType.name y @XmlType.namespace para asignarles nombres diferentes.
    this problem is related to the following location:
        at simic.soap.generated.repositorio.repositorioxds.PROVIDEANDREGISTERDOCUMENTSETResponse
        at public javax.xml.bind.JAXBElement simic.soap.generated.repositorio.repositorioxds.ObjectFactory.createPROVIDEANDREGISTERDOCUMENTSETResponse(simic.soap.generated.repositorio.repositorioxds.PROVIDEANDREGISTERDOCUMENTSETResponse)
        at simic.soap.generated.repositorio.repositorioxds.ObjectFactory
    this problem is related to the following location:
        at repositorioxds.PROVIDEANDREGISTERDOCUMENTSETResponse
Hay dos clases que tienen el mismo nombre de tipo XML "{RepositorioXDS}PING". Utilice @XmlType.name y @XmlType.namespace para asignarles nombres diferentes.
    this problem is related to the following location:
        at simic.soap.generated.repositorio.repositorioxds.PING
        at public javax.xml.bind.JAXBElement simic.soap.generated.repositorio.repositorioxds.ObjectFactory.createPING(simic.soap.generated.repositorio.repositorioxds.PING)
        at simic.soap.generated.repositorio.repositorioxds.ObjectFactory
    this problem is related to the following location:
        at repositorioxds.PING
Hay dos clases que tienen el mismo nombre de tipo XML "{RepositorioXDS}PINGResponse". Utilice @XmlType.name y @XmlType.namespace para asignarles nombres diferentes.
    this problem is related to the following location:
        at simic.soap.generated.repositorio.repositorioxds.PINGResponse
        at public javax.xml.bind.JAXBElement simic.soap.generated.repositorio.repositorioxds.ObjectFactory.createPINGResponse(simic.soap.generated.repositorio.repositorioxds.PINGResponse)
        at simic.soap.generated.repositorio.repositorioxds.ObjectFactory
    this problem is related to the following location:
        at repositorioxds.PINGResponse
...

我在生成的类中搜索了同名的@XmlType,但没有找到。真的很感谢任何建议

【问题讨论】:

  • 您是否有早期工作的剩余包“simic.soap.generated.repositorio.repositorioxds”? (我没有看到这个命名空间出现在您之前发布的 WSDL 中的 XML Schema 语句中 - 命名空间只是 RepositorioXDS,导致包 repositorioxds。) - 如果有,从头开始删除并重新构建。
  • “Utilice @XmlType ...”(即“使用...”,如果我的西班牙语足够好 ;-))意味着您应该添加这样的注释到 Java 代码,如果 Java 类是从 XML Schema 或其他生成的,这将毫无用处。
  • @laune 非常感谢!原谅我的无知。我已经更改了生成类的包。如果类在生成的包中,问题就解决了。我尝试使用 -p 进行 wsimpor,但收到错误 [ERROR] Two declarations cause a collision in the ObjectFactory class. 如何移动生成另一个包的类?

标签: java soap jaxb jax-ws


【解决方案1】:

除非您知道自己在做什么,否则不要摆弄生成的代码,然后您就不会。以下是我提出的解决原始问题的方法。

  1. 如果您可以调整 xjc 调用,选项 -p 就可以解决问题。 (如果 wsimport 选项 -p 应该有相同的效果我不知道出了什么问题。参数必须是有效的 Java 包名称,而不是 OS 路径。)

  2. 您可以定义命名空间以反映包名称,使用 simic.soap.generated.repositorio.repositorioxds 而不是 RepositorioXDS。

  3. 或者您可以通过添加定义包名称的自定义语句来自定义 XML Schema:

不要忘记将 jaxb 命名空间前缀定义添加到 &lt;xs:schema&gt; 和 JAXB 版本。

xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0"

【讨论】:

    猜你喜欢
    • 2011-05-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-04
    • 2011-06-01
    • 2012-01-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多