Pan*_*Pan 5 netbeans web-services jax-ws http-authentication webservice-client
如何通过基本的http身份验证访问网络服务?我正在使用netbeans内置的webservice客户端功能.但是,当我尝试访问Web服务时,我收到401 auth失败错误消息的异常.
如何传递正确的用户名和密码?
谢谢!
您可以使用 BindingProvider 或 WSBindingProvider 类通过基本的 http 身份验证来访问 Web 服务。代码如下。
XxxService service = new XxxService();
Xxx port = service.getXxxPort();
Map<String, Object> reqContext = ((BindingProvider)port).getRequestContext();
reqContext.put(BindingProvider.USERNAME_PROPERTY, "username");
reqContext.put(BindingProvider.PASSWORD_PROPERTY, "password");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6364 次 |
| 最近记录: |