尝试导入WSDL时找不到引用的类型

时间:2014-03-28 23:42:22

标签: java web-services wsdl mule wsimport

我正在尝试使用SOAP组件的Import WSDL从此WSDL在Mule中生成Java服务类,并生成JAX-WS类功能:https://www.tracegains.net/api/scsi.asmx?WSDL

Generate from WSDL Dialog

但是我得到undefined element declaration 's:schema' at line xx column yy of schema(错误重复了很多次)。

XML Schema Error

所以,基于这个答案:Error when using Jax to generate Proxy web service client我在本地保存了WSDL文件,并将引用从http://www.w3.org/2001/XMLSchema更改为http://www.w3.org/2001/XMLSchema.xsd

现在我得到了Part <parameters> in Message <{http://www.tracegains.net/Services}GetAttributesByIngredientSoapOut> referenced Type <{http://www.tracegains.net/Services}GetAttributesByIngredientResponse> can not be found in the schemas.

referenced Type can not be found in the schemas

我也尝试过Apache CXF 3.0.0中的wsimport工具,但我在那里得到了类似的结果:

[ERROR] Schema descriptor {http://www.tracegains.net/Services}Version in message part "parameters" is not defined and could not be bound to Java. Perhaps the schema descriptor {http://www.tracegains.net/Services}Version is not defined in the schema imported/included in the WSDL. You can either add such imports/includes or run wsimport and provide the schema location using -b switch.  line 774 of file:/D:/tg/tg_modified.wsdl

在我看来导入在tns命名空间上失败了,但是当我尝试浏览tns命名空间时,我得到了一个404:http://www.tracegains.net/Services这是问题所在还是还有别的什么我可以要做到这一点吗?

1 个答案:

答案 0 :(得分:0)

更可能的是,包含parameters定义的模式缺失,在生成存根和模型类时不会导入。解决方案是将WSDL和相关的XSD架构文件保存在本地,并使用正确的位置导入架构并重试这样做