从远程wsdl为jax-ws应用程序生成java工件

时间:2013-12-24 18:17:06

标签: web-services jax-ws

如何从远程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>

1 个答案:

答案 0 :(得分:0)

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

另外,你是否需要做任何事情来保护网址免受shell的解释?在OS X上,我们必须在url周围放置单引号字符,以便它可以在不进行更改的情况下进入可执行文件。您是否需要使用单引号或双引号或其他内容?