How can I use wsimport to generate a webservice client which wsdl requires authentication?

删除回忆录丶 提交于 2019-11-28 03:28:24

问题


I'm trying to generate a webservice client using wsimport, but the wsdl requires authentication.

I'm using a command like this: wsimport https://username:password@url?wsdl

But it doesn't work.


回答1:


After running your command you should get a message complaining about a missing web authorization file.

What you need to do is create an authorization file (usually the default name/location for it is $HOME_DIRECTORY/.metro/auth, but check the previous error message, you'll get the hint from there). Inside this file you just write the line: "https://username:password@url?wsdl"

Once the file is created, run the wsimport command again omitting the username/password info, like this:

wsimport https://url?wsdl

Hope it helps.




回答2:


wsimport -Xauthfile C:\resources\META-INF\auth.conf https://url?wsdl

auth.conf

https://USERNAME:PASWORD@url?wsdl


来源:https://stackoverflow.com/questions/6293722/how-can-i-use-wsimport-to-generate-a-webservice-client-which-wsdl-requires-authe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!