您的位置:首页 > 其它

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.

截图贴上来


我去这是什么情况 ,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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: