我正在尝试连接到旧的 Web 服务,并且当我使用 wsimport 和其他工具自动生成类时收到错误。
computer-name:tmp me$ wsimport -keep -verbose https://www.entech.us/sigmaaldrich/CarbonFootprintStats.asmx?WSDL
parsing WSDL...
[WARNING] src-resolve.4.2: Error resolving component 's:schema'. It was detected that 's:schema' is in namespace 'http://www.w3.org/2001/XMLSchema', but components from this namespace are not referenceable from schema document 'https://www.entech.us/sigmaaldrich/CarbonFootprintStats.asmx?WSDL#types?schema1'. If this is the incorrect namespace, perhaps the prefix of 's:schema' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'https://www.entech.us/sigmaaldrich/CarbonFootprintStats.asmx?WSDL#types?schema1'.
line 30 of https://www.entech.us/sigmaaldrich/CarbonFootprintStats.asmx?WSDL#types?schema1
[ERROR] undefined element declaration 's:schema'
line 30 of https://www.entech.us/sigmaaldrich/CarbonFootprintStats.asmx?WSDL
问题是我需要让他们编辑 WSDL 以删除 s:schema 吗? WSDL 通过了验证,这更奇怪。
我知道仍然可以提取数据,因为许多在线 SOAP 客户端测试工具甚至 Eclipse 都允许我导航和执行这些方法。
预先感谢您的指导!
最佳答案
当您查看第 30 行的 xsd 时,您会看到以下行:
<s:element ref="s:schema"/>
此元素引用名为 s:schema
的简单或复杂类型。它看起来像是仅该行上的错误。WSDL 和 XSD 的其余部分似乎没问题,但定义不太明确。例如,响应只是空 <s:any/>
标签。
他们需要澄清为什么他们试图声明一个元素来引用不存在的东西。它看起来确实像一个错误。
顺便说一下,WSDL 不符合 WSI。
关于java - wsimport 上的 WSDL 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23794647/