关于webservice在cmd运行报错问题

首先需要在eclipse中建一个java项目,这里不再赘述,可以参考https://blog.csdn.net/cs_hnu_scw/article/details/80181762#commentBox

建好之后运行该类,只运行一次,右键run as---java application,此时不要关闭控制台,即那个红色的按钮不要点击

如果运行了多次,请关闭关于这个java文件全部的console

 

保证以上步骤成功之后,在浏览器输入http://localhost:9090/MyFirstWebService   会显示

其中wsdl文件可以点进去的。之后

在cmd中输入wsimport -s . http://localhost:9090/MyFirstWebService时报错:

PS D:\java\workspace\webService\src> wsimport -s . http://localhost:9090/MyFirstWebService
parsing WSDL...


[ERROR] Invalid WSDL http://localhost:9090/MyFirstWebService, expected {http://schemas.xmlsoap.org/wsdl/}definitions found html at (line 1)

Failed to read the WSDL document: http://localhost:9090/MyFirstWebService, 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.

解决:

可能的问题:
1、在命令最后加入   ?wsdl

wsimport -s . http://localhost:9090/MyFirstWebService?wsdl

运行后成功显示:


Generating code...


Compiling code...

PS D:\java\workspace\webService\src>

之后刷新刚才新建的java项目,可以看到在src下生成了很多个java文件,代表成功了
2、将localhost改为你自己主机的ip,重新运行上面的命令

3、换一个端口号试一下,端口号可能被占用

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

那个小白猿

讨杯可乐

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值