用于具有 usernametoken 配置文件的安全 Web 服务的 JAXWS Metro 客户端
我想使用一个使用 oasis 风格的用户名令牌配置文件的网络服务( http://www.oasis-open.org/committees/download.php/16782/wss-v1.1-spec-os...)。
我可以使用 CXF 和 Weblogic 客户端来完成此操作,但我想使用纯 Metro 客户端。
你知道我该怎么做吗?
谢谢。
CXF 示例:
serviceClientPort = clientFactory.buildClientPort(wsdlUrl,null);
org.apache.cxf.endpoint.Client clientProxy = ClientProxy.getClient(serviceClientPort);
org.apache.cxf.endpoint.Endpoint cxfEndpoint = clientProxy.getEndpoint();
Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
outProps.put(WSHandlerConstants.USER, "someuser");
outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_DIGEST);
outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS,CapHardcodedPassProvider.class.getName());
WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
cxfEndpoint.getOutInterceptors().add(wssOut);
Weblogic 客户端:
CallService callService = new CallService(wsdlUrl,CAP_QNAME);
CallServicePort port = callService.getCallServiceSoapPort(new WebServiceFeature[] { cpf });
BindingProvider bindingProvider = (BindingProvider) port;
Map<String, Object> rc = (Map<String, Object>) bindingProvider.getRequestContext();
List<CredentialProvider> credProviders = new ArrayList<CredentialProvider>();
credProviders.add(new ClientUNTCredentialProvider(USERNAME.getBytes(), PASSWORD.getBytes()));
i want to consume a webservice that uses oasis style username token profile ( http://www.oasis-open.org/committees/download.php/16782/wss-v1.1-spec-os... ).
I was able to do it with CXF and Weblogic clients BUT iw woul like to use a pure Metro client.
Do you know how can I do that ?
Thanks.
CXF sample:
serviceClientPort = clientFactory.buildClientPort(wsdlUrl,null);
org.apache.cxf.endpoint.Client clientProxy = ClientProxy.getClient(serviceClientPort);
org.apache.cxf.endpoint.Endpoint cxfEndpoint = clientProxy.getEndpoint();
Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
outProps.put(WSHandlerConstants.USER, "someuser");
outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_DIGEST);
outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS,CapHardcodedPassProvider.class.getName());
WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
cxfEndpoint.getOutInterceptors().add(wssOut);
Weblogic client :
CallService callService = new CallService(wsdlUrl,CAP_QNAME);
CallServicePort port = callService.getCallServiceSoapPort(new WebServiceFeature[] { cpf });
BindingProvider bindingProvider = (BindingProvider) port;
Map<String, Object> rc = (Map<String, Object>) bindingProvider.getRequestContext();
List<CredentialProvider> credProviders = new ArrayList<CredentialProvider>();
credProviders.add(new ClientUNTCredentialProvider(USERNAME.getBytes(), PASSWORD.getBytes()));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)