我完全不了解网络服务相关的知识。
我需要为一个网络服务编写 rest web 服务客户端。该网络服务在 SoapUI 上运行良好。我已经获得了该 URL 的 WSDL 文件。但是,当我将 wsdl 文件添加到我的 Eclipse 项目中时,它却出现了编译错误。
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 -d e:\test -s E:\wssrc http://chec.local/STAR.WCF/CorpsiteService.svc?singlewsdl -wsdllocation "../../../../../WEB-INF/wsdl/CorpsiteService.svc.wsdl"
我卡在这一点上,已经挣扎了整整一天。 对于此事的任何帮助都将非常有用。
wsimport
,而是使用Apache CXF的wsdl2java
工具来生成这些代码。我避免使用Glassfish,因为我过去曾遇到一些与其无关的问题(关于自定义数据序列化,无论我尝试什么都无法解决,而CXF则可以直接使用!)。 - jlr