wsimport with special character and Xauthfile

6.1k views Asked by At

I'm facing the same problem that this guy here:

wsimport Xauthfile error

Since he didn't gave a feedback and I'm new here and can't ask him if he solved his problem I'm opening a new question.

I'm using ubuntu and have JDK7 from java oracle installed.

I'm consuming a thirdparty web service. The password (...GT@#ED...) for the webservice have a character that conflicts with de -Xauthfile syntax (http[s]://user:password@host:port//) because of the "@". The dots (...) represents the rest of my password.

Here is the command I'm running:

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

In my auth.txt file I have:

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

In return a get

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>

I search all over the net, but no success.

When I try to import the WS using SoapUI like in this tutorial I got a

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

and I don't know where to specify the ssl file for SoapUI. I tryed in

preferences -> SSL Settings

but no lucky.

That's it. I'll apreciate any help.

EDIT

OK, so I pass through the authorization, changing the characters using the HTML URL Encoding Reference, but now I'm getting the following error

[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>
2

There are 2 answers

0
Mohammad Sadegh Rafiei On

I am using Apache axis2 instead of wsimport. first this problem happened for me, and I write a bash script and it worked.

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

I also use encoding password and username by 'url encoding' such as bellow:

@#%g3E99! -(URL encoding)-> %40%23%25g3E99%21

0
Talwinder Kaur On

First create auth.txt file where you need to put the following and save it in C drive:

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

Now run the following command:

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

This worked for me.