WebService wsimport Xauthfile

今天我根据其他公司提供的WebService接口的wsdl文件生成客户端调用代码时,遇到两个问题

1.对方的wsdl文件中包含了自己定制的描述文件,这些个文件需要从wsdl文档中的地址去访问,由于我这边无法访问对方的内部网络,导致连接失败,无法生成客户端,最后是在对方公司内网中的电脑上生成的客户端调用代码

2.对方设置了WebService接口访问授权,需要在wsimport上加上-Xauthfile命令参数,该参数指定了授权用户密码所在的文件路径,文件中的格式如下
http://username:pwd@host:port/serverpath?wsdl

然后以如下命令生成客户端调用代码
wsimport -keep -p com.mypackage.client -Xauthfile D:\Xauthfile.txt http://host:port/serverpath?wsdl

没有添加-Xauthfile命令参数时,报错信息如下:

[ERROR] Server returned HTTP response code: 401 for URL:http://host:port/serverpath?wsdl,
"http://host:port/serverpath?wsdl " needs authorization,please provide 
authorization file with read access at C:\Users\Administrator\.metro\auth or 
use -Xauthfile to http[s]://user:password@host:port//<url-path>

添加-Xauthfile命令参数后,如有以下报错信息,可能是该服务暂时不能访问,或者用户名密码错误:

[ERROR] Server redirected too many  times (20),  "http://host:port/serverpath?wsdl" 
needs authorization, please provide authorization file with read access at C:\Users\Administrator\.metro\auth 
or use -Xauthfile to give the authorization file and on each line provide authorization information 
using this format :http[s]://user:password@host:port//<url-path>
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值