【问题标题】:generating java artifacts for jax-ws application from remote wsdl从远程 wsdl 为 jax-ws 应用程序生成 java 工件
【发布时间】:2013-12-24 18:17:06
【问题描述】:

如何从远程 wsdl 为 jax-ws 应用程序生成 java 工件(Web 服务客户端)。

我尝试了以下选项,但没有运气。是他们创建它的任何其他方式。

wsimport -d d:\test\ -s d:\cool wsdlurl(which is remote url)(eg.. http://servername/service.asmx?WSDL)

上面的命令在windows命令提示符下运行出现以下错误。

[ERROR] Property "Any" is already defined. Use <jaxb:property> to resolve this conflict.
line 37 of http://xxx.xxxindia.com/service.asmx?WSDL

任何帮助将不胜感激。谢谢

添加一段 WSDL 以供参考。我在“任何”属性点出现错误

       <?xml version="1.0" encoding="utf-8"?>
        <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"                          
        xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"  
        xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
        xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://well.service.com/" 
        xmlns:s="http://www.w3.org/2001/XMLSchema" 
        xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
        xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
        targetNamespace="http://well.service.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

     <wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://well.service.com/">
  <s:element name="WhoAmI">
    <s:complexType>
      <s:sequence>
        <s:element minOccurs="1" maxOccurs="1" name="AccountId" type="s:int" />
        <s:element minOccurs="0" maxOccurs="1" name="UserName" type="s:string" />
        <s:element minOccurs="0" maxOccurs="1" name="Password" type="s:string" />
      </s:sequence>
    </s:complexType>
  </s:element>
  <s:element name="WhoAmIResponse">
    <s:complexType>
      <s:sequence>
        <s:element minOccurs="0" maxOccurs="1" name="WhoAmIResult" type="s:string" />
      </s:sequence>
    </s:complexType>
  </s:element>
  <s:element name="SourceCity_InTravelTypeID">
    <s:complexType>
      <s:sequence>
        <s:element minOccurs="1" maxOccurs="1" name="TravelTypeID" type="s:int" />
        <s:element minOccurs="1" maxOccurs="1" name="AccountId" type="s:int" />
        <s:element minOccurs="0" maxOccurs="1" name="UserName" type="s:string" />
        <s:element minOccurs="0" maxOccurs="1" name="Password" type="s:string" />
      </s:sequence>
    </s:complexType>
  </s:element>
  <s:element name="SourceCity_InTravelTypeIDResponse">
    <s:complexType>
      <s:sequence>
        <s:element minOccurs="0" maxOccurs="1" name="SourceCity_InTravelTypeIDResult">
          <s:complexType>
            <s:sequence>
              <s:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax" />
              <s:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax" />
            </s:sequence>
          </s:complexType>
        </s:element>
      </s:sequence>
    </s:complexType>
  </s:element>
  <s:element name="DestinationCity_InTravelTypeID">
    <s:complexType>
      <s:sequence>
        <s:element minOccurs="1" maxOccurs="1" name="TravelTypeID" type="s:int" />
        <s:element minOccurs="1" maxOccurs="1" name="StateID" type="s:int" />
        <s:element minOccurs="1" maxOccurs="1" name="AccountId" type="s:int" />
        <s:element minOccurs="0" maxOccurs="1" name="UserName" type="s:string" />
        <s:element minOccurs="0" maxOccurs="1" name="Password" type="s:string" />
      </s:sequence>
    </s:complexType>
  </s:element>
  <s:element name="DestinationCity_InTravelTypeIDResponse">
    <s:complexType>
      <s:sequence>
        <s:element minOccurs="0" maxOccurs="1" name="DestinationCity_InTravelTypeIDResult">
          <s:complexType>
            <s:sequence>
              <s:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax" />
              <s:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax" />
            </s:sequence>
          </s:complexType>
        </s:element>
      </s:sequence>
    </s:complexType>
  </s:element>
   </s:schema>

【问题讨论】:

    标签: web-services jax-ws


    【解决方案1】:

    好吧,我可以提出一些建议。首先,什么是“wsimpot”?您指的是 “wsimport” 吗?既然你在 Windows 上,你的意思是“wsimport.exe”吗?

    另外,你需要做些什么来保护 url 不被 shell 解释吗?在 OS X 上,我们必须在 url 周围加上单引号字符,这样它才能在不被更改的情况下通过可执行文件。您需要使用单引号还是双引号或其他东西?

    【讨论】:

    • @Ray.. 我在 Windows 命令提示符下运行的上述命令。我只是在这里用谷歌搜索了它..mkyong.com/webservices/jax-ws/jax-ws-wsimport-tool-example。并尝试过。
    • 那么你应该修正你的问题中的错字。单词“wsimport”中有一个“r”。你的没有。
    • @Ray.. 我在这里更正了拼写错误。我运行了相同的命令,但得到了与前面提到的相同的错误。
    • “和我之前提到的一样的错误”?你提到了什么错误?你说“不走运”。这是什么错误?
    • 很抱歉没有发布错误。现在复制帖子中的错误。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-06
    • 1970-01-01
    • 1970-01-01
    • 2012-08-09
    相关资源
    最近更新 更多