webService(cxf)生成客户端报错解决
2017-10-17 13:18
302 查看
本来准备在eclispe 里面生成的,后来发现 127.0.0.1 和localhost 是生成不了 。后来准备用cmd 生成。
命令:
wsimport -s D:\Users\tao\workspace\cxfDemoClient -p com.client -keep http://127.0.0.1:8008/cxfDemo/ws/demoCXF?wsdl
结果报错:
C:\Users\tao>wsimport -s D:\Users\tao\workspace\cxfDemoClient -p com.client -kee
p http://127.0.0.1:8008/cxfDemo/ws/demoCXF?wsdl
parsing WSDL...
[ERROR] XML 文档结构必须从头至尾包含在同一个实体内。
line 4 of http://127.0.0.1:8008/cxfDemo/ws/demoCXF?wsdl
[ERROR] XML 文档结构必须从头至尾包含在同一个实体内。
Failed to read the WSDL document: http://127.0.0.1:8008/cxfDemo/ws/demoCXF?wsdl,
because 1) could not find the document; /2) the document could not be read; 3)
the root element of the document is not <wsdl:definitions>.
[ERROR] failed.noservice=Could not find wsdl:service in the provided WSDL(s):
At least one WSDL with at least one service definition needs to be provided.
Failed to parse the WSDL.
截图贴上来
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/04/821bcffa43a232f16fdf3ff9f1359c8b)
我去这是什么情况 ,wsdl 绝对没有问题。那么怎么解决呢?
先在你的浏览器里面将该页面另存为。。。。
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/04/1f00ed2fbfc4fc37272f3ea95627bd2b)
我是另存为demoCXF.xml,然后在cmd 窗口切换到存的盘符输入
命令:
C:\Users\tao\Desktop>wsimport -s D:\Users\tao\workspace\cxfDemoClient -p com.client -keep demoCXF.xml
![](https://oscdn.geek-share.com/Uploads/Images/Content/202009/04/8261eafc138b89644e4cebdc7cea5098)
好了搞定了。
命令注解:
D:\Users\tao\workspace\cxfDemoClient >>>>>eclipse工作空间的项目目录
-d <directory> 指定输出目录
-b <path> 指定JAXWS或者JAXB的绑定文件,可以多个
-B <jaxbOption> 指定JAXB的参数,透传给JAXB命令
-catalog 绑定外部WSDL或XSD,解决外部WSDL或者XSD引用
-extension Allow vendor extensions (functionality not specified by the specification). Use of extensions may result in applications that are not portable or may not interoperate with other implementations.
-help 显示帮助
-httpproxy:<host>:<port> 指定一个HTTP代理
-keep 保留源文件
-p <pkg> 指定包名
-s <directory> 指定源代码存放目录
-encoding <encoding> 指定编码格式,例如UTF-8
-verbose 指定输出命令执行的详细信息
-version 显示版本
-fullversion 显示详细的版本信息
-clientjar <jarfile> Creates the jar file of the generated artifacts along with the WSDL metadata required for invoking the web service.
-wsdllocation <location> @WebServiceClient.wsdlLocation value.
-target <version> 指定JAX-WS的版本,默认是 2.2.
-quiet 静默执行该命令,不在屏幕输出信息
-XadditionalHeaders Map the headers not bound to request or response message to Java method parameters.
-Xauthfile File to carry authorization information in the format http://username:password@example.org/stock?wsdl. Default value is $HOME/.metro/auth
-Xdebug 显示DEBUG信息
-XdisableAuthenticator Disables Authenticator used by JAX-WS RI, -Xauthfile option will be ignored if -XdisableAuthenticatoris set.
-Xno-addressing-databinding 不使用JDK的Addressing,生成自己的EndpointReferenceType
-Xnocompile 不编译生成的源码
-XdisableSSLHostnameVerification Disbales the SSL Hostname verification while fetching the wsdls.
参考资料
http://mhsjlove.iteye.com/blog/1838339
命令:
wsimport -s D:\Users\tao\workspace\cxfDemoClient -p com.client -keep http://127.0.0.1:8008/cxfDemo/ws/demoCXF?wsdl
结果报错:
C:\Users\tao>wsimport -s D:\Users\tao\workspace\cxfDemoClient -p com.client -kee
p http://127.0.0.1:8008/cxfDemo/ws/demoCXF?wsdl
parsing WSDL...
[ERROR] XML 文档结构必须从头至尾包含在同一个实体内。
line 4 of http://127.0.0.1:8008/cxfDemo/ws/demoCXF?wsdl
[ERROR] XML 文档结构必须从头至尾包含在同一个实体内。
Failed to read the WSDL document: http://127.0.0.1:8008/cxfDemo/ws/demoCXF?wsdl,
because 1) could not find the document; /2) the document could not be read; 3)
the root element of the document is not <wsdl:definitions>.
[ERROR] failed.noservice=Could not find wsdl:service in the provided WSDL(s):
At least one WSDL with at least one service definition needs to be provided.
Failed to parse the WSDL.
截图贴上来
我去这是什么情况 ,wsdl 绝对没有问题。那么怎么解决呢?
先在你的浏览器里面将该页面另存为。。。。
我是另存为demoCXF.xml,然后在cmd 窗口切换到存的盘符输入
命令:
C:\Users\tao\Desktop>wsimport -s D:\Users\tao\workspace\cxfDemoClient -p com.client -keep demoCXF.xml
好了搞定了。
命令注解:
D:\Users\tao\workspace\cxfDemoClient >>>>>eclipse工作空间的项目目录
-d <directory> 指定输出目录
-b <path> 指定JAXWS或者JAXB的绑定文件,可以多个
-B <jaxbOption> 指定JAXB的参数,透传给JAXB命令
-catalog 绑定外部WSDL或XSD,解决外部WSDL或者XSD引用
-extension Allow vendor extensions (functionality not specified by the specification). Use of extensions may result in applications that are not portable or may not interoperate with other implementations.
-help 显示帮助
-httpproxy:<host>:<port> 指定一个HTTP代理
-keep 保留源文件
-p <pkg> 指定包名
-s <directory> 指定源代码存放目录
-encoding <encoding> 指定编码格式,例如UTF-8
-verbose 指定输出命令执行的详细信息
-version 显示版本
-fullversion 显示详细的版本信息
-clientjar <jarfile> Creates the jar file of the generated artifacts along with the WSDL metadata required for invoking the web service.
-wsdllocation <location> @WebServiceClient.wsdlLocation value.
-target <version> 指定JAX-WS的版本,默认是 2.2.
-quiet 静默执行该命令,不在屏幕输出信息
-XadditionalHeaders Map the headers not bound to request or response message to Java method parameters.
-Xauthfile File to carry authorization information in the format http://username:password@example.org/stock?wsdl. Default value is $HOME/.metro/auth
-Xdebug 显示DEBUG信息
-XdisableAuthenticator Disables Authenticator used by JAX-WS RI, -Xauthfile option will be ignored if -XdisableAuthenticatoris set.
-Xno-addressing-databinding 不使用JDK的Addressing,生成自己的EndpointReferenceType
-Xnocompile 不编译生成的源码
-XdisableSSLHostnameVerification Disbales the SSL Hostname verification while fetching the wsdls.
参考资料
http://mhsjlove.iteye.com/blog/1838339
相关文章推荐
- 使用cxf生成webservice客户端调用异常解决
- CXF生成webservice动态客户端
- Eclipse根据wsdl文件生成webService(cxf)客户端(二)
- 用apache-cxf生成webservice客户端的时候报错Parameter: shead already exists for method
- cxf 生成webservice客户端代码
- CXF生成webservice客户端 发生undefined element declaration
- CXF获取客户端IP(解决WebServiceContext为null问题)
- cxf开发webService,服务中包含枚举enum时,客户端用eclipse生成会出现传递的枚举是空值
- CXF webService 对象属性值为null或空时生成xml缺少该字段节点 解决办法
- cxf生成webservice的java客户端代码
- 【CXF】wsdl2java 生成客户端: 具有相同名称 "xxx" 的类/接口已在使用。请使用类定制设置来解决此冲突。
- 用cxf生成webservice的java客户端代码
- webService-cxf方式生成客户端
- axis 客户端调用CXF的webservice 解决参数传递不过去的问题
- webservice 服务端例子+客户端例子+CXF整合spring服务端测试+生成wsdl文件 +cxf客户端代码自动生成
- CXF生成调用webservice的客户端
- cxf发布webservice简介 及 wsdl2java生成客户端代码
- cxf生成java客户端 webservice
- 用apache-cxf生成webservice客户端的时候报错Parameter: shead already exists for method
- cxf生成webservice客户端代码