4

我在这里遇到了与此人相同的问题:

wsimport Xauthfile 错误

由于他没有提供反馈,而且我是新来的,所以不能问他是否解决了他的问题,我正在提出一个新问题。

我正在使用 ubuntu 并安装了来自 java oracle 的 JDK7。

我正在使用第三方网络服务。由于“@ ”。点 (...) 代表我的密码的其余部分。

这是我正在运行的命令:

wsimport -p loa -Xauthfile "path_to_auth.txt" https://myWS?wsdl

在我的 auth.txt 文件中,我有:

https://user:...GT@#ED...@myWS?wsdl

作为回报

parsing WSDL...    
[ERROR] Server returned HTTP response code: 401 for URL: https://myWS?wsdl,  
"https://myWS?wsdl" needs authorization, please provide authorization file with
read access at /home/user_name/.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>

我在网上搜索,但没有成功。

当我尝试像本教程中那样使用 SoapUI 导入 WS 时,我得到了一个

[ERROR] sun.security.validator.ValidatorException: PKIX path building failed: 
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid 
certification path to requested target

而且我不知道在哪里为 SoapUI 指定 ssl 文件。我试过了

首选项 -> SSL 设置

但没有幸运。

而已。我会感谢任何帮助。

编辑

好的,所以我通过了授权,使用HTML URL Encoding Reference更改字符,但现在我收到以下错误

[ERROR] Server redirected too many  times (20),  "https://ws?wsdl" needs 
authorization, please provide authorization file with read access at /home/user
/.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>
4

2 回答 2

0

我使用的是 Apache axis2 而不是 wsimport。首先这个问题发生在我身上,我编写了一个 bash 脚本并且它有效。

#!/bin/bash
/axis2-1.7.9/bin/wsdl2java.sh -uri http://username:password@domain/x?wsdl 

我还通过“url编码”使用编码密码和用户名,如下所示:

@#%g3E99!-(网址编码)-> %40%23%25g3E99%21

于 2020-03-02T09:02:38.687 回答
-1

首先创建 auth.txt 文件,您需要在其中放置以下内容并将其保存在 C 盘:

http://username:password@localhost:port/wsdlurl

现在运行以下命令:

wsimport -Xauthfile C:\auth.txt -keep http://example.com/test?wsdl 

这对我有用。

于 2016-08-31T14:36:26.103 回答