【发布时间】:2018-01-24 06:52:21
【问题描述】:
我需要在 JBoss 上使用 JAX-WS 创建一个 SOAP 客户端。 问题是我无法通过身份验证。
我在 SoapUI 中实现了一个测试,当我设置请求属性用户名和密码 时,该测试有效
使用以下代码
URL kbaURL = new URL("http://...");
IkfzService ikfzService = new IkfzService(kbaURL);
IkfzPortType ikfzPortType = ikfzService.getIkfzSOAP();
Map<String, Object> requestContext = ((BindingProvider)ikfzPortType).getRequestContext();
requestContext.put(BindingProvider.USERNAME_PROPERTY, "...");
requestContext.put(BindingProvider.PASSWORD_PROPERTY, "...");
URL、用户名和密码与我得到的 SOAPUI 中的相同
javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException:
Failed to create service.
...
Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR:
Problem parsing 'http://..'.: java.io.IOException: Server returned HTTP response code:
401 for URL: http://..
我错过了什么?
【问题讨论】:
-
您真的想使用
URL kbaURL = new URL("http://...");作为您的 SOAP Web 服务端点吗?我认为Problem parsing 'http://..有点表明你是。 SOAP 端点“WSDL”应该设置为您在 SOAP-UI 中使用的那个
标签: security authentication soap jax-ws soapui