標籤:webservice wsdl
錯誤碼如下:
E:\>wsimport -keep service.xml
parsing WSDL...
[WARNING] src-resolve: Cannot resolve the name ‘soapenc:Array‘ to a(n) ‘type definition‘ component.
line 505 of file:/E:/service1.xml#types?schema2
[ERROR] undefined simple or complex type ‘soapenc:Array‘
line 505 of file:/E:/service1.xml
錯誤原因:
net那邊給的wsdl使用的規範過低,產生之後的不認原來的那種規範,使產生代碼不適應我們java這邊的使用。
<s:schema targetNamespace="http://tempuri.org/AbstractTypes"> <s:import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> <s:complexType name="ArrayOfString"> <s:sequence> <s:element minOccurs="0" maxOccurs="unbounded" name="string" nillable="true" type="s:string" /> </s:sequence> </s:complexType> <s:complexType name="StringArray"> <s:complexContent mixed="false"> <s:restriction base="soapenc:Array"> <s:sequence> <s:element minOccurs="0" maxOccurs="unbounded" name="String" type="s:string" /> </s:sequence> </s:restriction> </s:complexContent> </s:complexType>
更改後:
<s:schema targetNamespace="http://tempuri.org/AbstractTypes"> <s:import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> <s:complexType name="ArrayOfString"> <s:sequence> <s:element minOccurs="0" maxOccurs="unbounded" name="string" nillable="true" type="s:string" /> </s:sequence> </s:complexType> </s:schema>
重新執行:
wsimport -keep service.xml 成功產生。
解決辦法是從一個英文的網站上查到的,所以定為翻譯,可惜現在再總結找不到那個網址了TAT!