CXF使用wsdl生成的webservice客户端用户名密码验证,超时设置
程序员文章站
2022-06-13 21:00:30
...
//设置webservice用户名密码,接口验证
BindingProvider bp = (BindingProvider) port;
Map<String, Object> context = bp.getRequestContext();
context.put(BindingProvider.USERNAME_PROPERTY, "username");
context.put(BindingProvider.PASSWORD_PROPERTY, "password");
//设置连接超时时间,使用BindingProviderProperties.CONNECT_TIMEOUT
context.put(BindingProviderProperties.CONNECT_TIMEOUT,10*1000);
//设置请求超时时间,使用BindingProviderProperties.REQUEST_TIMEOUT
context.put(BindingProviderProperties.REQUEST_TIMEOUT, 60* 1000);