未定义的元素声明’xs:schema’

我是网络服务的新手。

我必须为Web服务编写rest Web服务客户端。 Web服务在SoapUI上运行良好。 URL的WSDL文件提供给我。 但是当我在Eclipse项目中添加wsdl文件时,它会产生编译错误

src-resolve.4.2: Error resolving component 'xs:schema'. It was detected that 'xs:schema' is in namespace 'http://www.w3.org/2001/XMLSchema', but components from this namespace are not referenceable from schema document 'file:///E:/Ashish%20Workspace/HATStoLSAMS%20Webservice/HATS2LSAMSWS/WebContent/WEB-INF/wsdl/CorpsiteService.svc.wsdl'. If this is the incorrect namespace, perhaps the prefix of 'xs:schema' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'file:///E:/Ashish%20Workspace/HATStoLSAMS%20Webservice/HATS2LSAMSWS/WebContent/WEB-INF/wsdl/CorpsiteService.svc.wsdl'. 

我搜索了很多东西来摆脱这些错误,但没有任何效果。 如果我忽略错误并尝试使用wsimport和wsdl2java命令创建存根,则会出错

 [ERROR] undefined element declaration 'xs:schema' line 1 of http://chec.local/STAR.WCF/CorpsiteService.svc?singlewsdl 

我使用下面的命令来生成存根

 wsimport -de:\test -s E:\wssrc http://chec.local/STAR.WCF/CorpsiteService.svc?singlewsdl -wsdllocation "../../../../../WEB-INF/wsdl/CorpsiteService.svc.wsdl" 

我在这一点上陷入困​​境,并且整天都在努力。 任何有关这方面的帮助都会非常有帮助

对此的解决方案似乎是为xs:schema提供备用绑定,如https://metro.java.net/2.1/guide/Dealing_with_schemas_that_are_not_referenced.html中所述

具体来说,对于经常导入命名空间xs的http://www.w3.org/2001/XMLSchema ,还有一些额外的工作需要完成。

该命令将是: wsimport -b http://www.w3.org/2001/XMLSchema.xsd -b customization.xjb something.wsdl

从上面链接的customization.xjb位于https://www.java.net//blog/kohsuke/archive/20070228/xsd.xjb或从下面复制

此自定义用于处理可能因使用架构架构(在多个架构中作为同一名称空间导入)而产生的某些命名冲突。

customization.xjb

                         

我已经尝试了这些文件和关联的-b参数到wsimport并且已经(显然)已经过了这个错误(并转到其他错误)。 也就是说,我并不是100%肯定我的新错误不是由此引起的(因此这不是一个完整的答案)。 如果没有实际的wsdl导致问题,人们只能在解决问题时采取合理的猜测(并进入下一个问题)。