File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Issue with -Xauthfile execution in wsimport tool(JAX-RI) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Issue with -Xauthfile execution in wsimport tool(JAX-RI)" Watch "Issue with -Xauthfile execution in wsimport tool(JAX-RI)" New topic

Issue with -Xauthfile execution in wsimport tool(JAX-RI)

Niranjana Sr

Joined: Nov 16, 2011
Posts: 1
Hello developers,

I am facing one issue while trying to execute wsimport tool.

command is

wsimport -Xendorsed -keep -Xauthfile authFile.txt -p -s D:\generated -d D:\generated

and I have provided following values in authFile.txt

Error message as folows.

[ERROR] Server returned HTTP response code: 401 for URL:, "" needs authorization, please provide authorization file with read access at C:\Documents and Settings\niranjan\.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>

Searched a lot in internet but of no help.
if anyone has already faced similar issue, and if fix be posted here will be very helpful.

Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
My guess is that the web.xml deployment descriptor of the web service is not properly configured.
One should specify POST in the <http-method> element, as in the example below, not GET.
If you specify POST, then only requests sent to the service will require login and password. Requests for the WSDL, that use GET, will not require authentication.

Fragment from a web.xml deployment descriptor in which the security constraints for a web service has been specified:

Best wishes!

My free books and tutorials:
Vijay Vishwa
Ranch Hand

Joined: Nov 21, 2010
Posts: 32

I also faced similar issue while generating webservice client code with authorization.
I was searching on the web for resolution but could't get any concrete answer

After doing various RnD I was able to resolve the issue, so thought of putting resolution over here so that other people can find the solution.

Although error message gives the format as

1. avoid "//" after port
2. include full wsdl url in the auth file

in my auth file I had following entry

and generated code with the command

It worked and generated code.

SCJP 5.0 OCBCD 5.0(Formerly SCBCD)
I agree. Here's the link:
subject: Issue with -Xauthfile execution in wsimport tool(JAX-RI)
It's not a secret anymore!