i tried automatically creating a java webservices client for the following wsdl:
http://localhost:9001/wservice3/services/AdminWebService?wsdl
but running the following command in a terminal:
wsimport -keep -verbose http://localhost:9001/wservice3/services/AdminWebService?wsdl
gave me the following error:
parsing WSDL...
[ERROR] Server returned HTTP response code: 401 for URL: http://localhost:9001/wservice3/services/AdminWebService?wsdl, "http://localhost:9001/wservice3/services/AdminWebService?wsdl" needs authorization, please provide authorization file with read access at /home/me/.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>
so to make it work i had to first create an authfile composed of the wsdl URI plus my username and password:
echo http://myUsername:myPassword@localhost:9001/wservice3/services/AdminWebService?wsdl > wsxauthfile
then i ran the wsimport command again, this time with the flag -Xauthfile:
wsimport -keep -verbose -Xauthfile wsxauthfile http://localhost:9001/wservice3/services/AdminWebService?wsdl
and it generated the code for me in the current directory (i ran it from ~/Downloads/)
:)
-------------------FYI----------------------
here's the output i saw:
parsing WSDL...
[INFO] Trying to read authorization file : "wsxauthfile"...
generating code...
wservice3/server3/AdminWebService.java
wservice3/server3/AdminWebServiceService.java
wservice3/server3/GetNextThousandNewMessageCounter.java
wservice3/server3/GetNextThousandNewMessageCounterResponse.java
wservice3/server3/GetNextThousandNewTransportRequest.java
wservice3/server3/GetNextThousandNewTransportRequestResponse.java
wservice3/server3/MaxIdFromMessageCounter.java
wservice3/server3/MaxIdFromMessageCounterResponse.java
wservice3/server3/MaxIdFromTransportRequest.java
wservice3/server3/MaxIdFromTransportRequestResponse.java
wservice3/server3/MinIdFromMessageCounter.java
wservice3/server3/MinIdFromMessageCounterResponse.java
wservice3/server3/MinIdFromTransportRequest.java
wservice3/server3/MinIdFromTransportRequestResponse.java
wservice3/server3/ObjectFactory.java
wservice3/server3/package-info.java
compiling code...
javac -d /home/me/Downloads/. -classpath /usr/lib/jvm/java-6-openjdk-amd64/lib/tools.jar:/usr/lib/jvm/java-6-openjdk-amd64/classes -Xbootclasspath/p:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/rt.jar:/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/rt.jar /home/me/Downloads/./wservice3/server3/AdminWebService.java /home/me/Downloads/./wservice3/server3/AdminWebServiceService.java /home/me/Downloads/./wservice3/server3/GetNextThousandNewMessageCounter.java /home/me/Downloads/./wservice3/server3/GetNextThousandNewMessageCounterResponse.java /home/me/Downloads/./wservice3/server3/GetNextThousandNewTransportRequest.java /home/me/Downloads/./wservice3/server3/GetNextThousandNewTransportRequestResponse.java /home/me/Downloads/./wservice3/server3/MaxIdFromMessageCounter.java /home/me/Downloads/./wservice3/server3/MaxIdFromMessageCounterResponse.java /home/me/Downloads/./wservice3/server3/MaxIdFromTransportRequest.java /home/me/Downloads/./wservice3/server3/MaxIdFromTransportRequestResponse.java /home/me/Downloads/./wservice3/server3/MinIdFromMessageCounter.java /home/me/Downloads/./wservice3/server3/MinIdFromMessageCounterResponse.java /home/me/Downloads/./wservice3/server3/MinIdFromTransportRequest.java /home/me/Downloads/./wservice3/server3/MinIdFromTransportRequestResponse.java /home/me/Downloads/./wservice3/server3/ObjectFactory.java /home/me/Downloads/./wservice3/server3/package-info.java
IT, computer and programming tutorials and tips that i couldnt find anywhere else using google, from my daily work as a Senior Developer of solutions using Java and Linux.
Subscribe to:
Post Comments (Atom)
Looks like you had basic authentication for service. I have NTLM authentication. I tried with authfile but it doesn't work. Does Xauthfile is only relevant for basic authentication?
ReplyDeletebut same procedure is giving file not found exception for xauthfile, I verified the path its correct. i saved it on desktop C:\Users\asif\xauthfile
ReplyDelete