繁体   English   中英

wsimport:生成Java SOAP客户端时的类自定义绑定

[英]wsimport: class customization bindings when generating a Java SOAP client

我正在尝试使用'wsimport'为此WebService生成Java SOAP客户端:

https://mutalyzer.nl/services/?wsdl

我收到错误,因为有两个名为'transcriptInfo'和'TranscriptInfo'的节点:

[错误]具有相同名称“nl.mutalyzer._2_0.services.TranscriptInfo”的类/接口已在使用中。 使用类自定义来解决此冲突。 https://mutalyzer.nl/services/?wsdl的第2行

我使用了wsimport参数-B-XautoNameResolution并且不起作用:

[错误]两个声明会导致ObjectFactory类发生冲突。 ......的第2行

我正在尝试进行Class customizacion。 我正在使用名为'nameCorrections.xml'的绑定文件,其中包含:

<jaxws:bindings
    wsdlLocation="https://mutalyzer.nl/services/?wsdl"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
    xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
    <jaxws:bindings node="wsdl:definitions/wsdl:types/xs:schema/xs:complexType[@name='transcriptInfo']">
        <jaxws:class name="TranscriptInfoByNM"/>
    </jaxws:bindings>
</jaxws:bindings>

当我跑步时,它不起作用:

wsimport -b nameCorrections.xml http ...(WDSL URL,我不能发布两个以上的链接)

我收到了这个错误:

[警告] s4s-elt-invalid-content.1:'transcriptInfo'的内容无效。 元素'绑定'无效,错位或过于频繁发生。 线? htt ....我做错了什么?

我认为应该使用'jaxb'Bindings而不是'jaxws'。 最后,我使用这个绑定文件使wsimport正常工作:

<jaxws:bindings
wsdlLocation="https://mutalyzer.nl/services/?wsdl"
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">
<jaxws:bindings node="wsdl:definitions/wsdl:types/xs:schema">
    <jaxb:bindings node="//xs:complexType[@name='transcriptInfo']">
        <jaxb:class name="TranscriptInfoByNM"/>
    </jaxb:bindings>
    <jaxb:bindings node="//xs:element[@name='transcriptInfo']">
        <jaxb:class name="ElementTranscriptInfoByNM"/>
    </jaxb:bindings>
</jaxws:bindings>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM