- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在为此实现一个网络服务客户端 https://efactura.dgi.gub.uy:6470/ePrueba/ws_personaGetActEmpresarialPrueba?wsdl 3rd 方 wsdl。
我使用 apache-cxf-3.0.4 wsdl2java 生成了 java 类。
端点需要使用 ws-security 和 X.509 证书签名进行签名。为了解决这个问题,我配置了一些 Out 拦截器,但出现“无法满足任何策略替代方案”的异常。
以下是配置拦截器并执行肥皂调用的代码:
Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE + " " + WSHandlerConstants.TIMESTAMP);
outProps.put(WSHandlerConstants.SIGNATURE_PARTS, "");
outProps.put(WSHandlerConstants.USER, "<aliasCertName>");
outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, ClientCallbackHandler.class.getName());
outProps.put(WSHandlerConstants.SIG_PROP_FILE, "client_sign.properties");
outProps.put(WSHandlerConstants.SIGNATURE_PARTS, "{Element}{http://docs.oasis-open.org/ws-sx/ws-securitypolicy/v1.2/ws-securitypolicy-1.2.xsd}SignedParts;{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp;{Element}{http://schemas.xmlsoap.org/soap/envelope/}Body;");
outProps.put(WSHandlerConstants.ENCRYPTION_PARTS, "{http://www.w3.org/2000/09/xmldsig#}Signature;{Content}{http://schemas.xmlsoap.org/soap/envelope/}Body");
outProps.put(WSHandlerConstants.ENC_PROP_FILE, "client_sign.properties");
/*
* Create service, port and send the request
*/
ObjectFactory objectFactory = new ObjectFactory();
WSPersonaGetActEmpresarialExecute req = objectFactory.createWSPersonaGetActEmpresarialExecute();
req.setRut("21047573001133");
WSPersonaGetActEmpresarial service = new WSPersonaGetActEmpresarial();
WSPersonaGetActEmpresarialSoapPort port = service.getWSPersonaGetActEmpresarialSoapPort();
//Obtain a reference to the CXF endpoint using the ClientProxy helper:
Client client = ClientProxy.getClient(wsPersonaGetActEmpresarialSoapPort);
client.getOutInterceptors().add(new WSS4JOutInterceptor(outProps));
WSPersonaGetActEmpresarialExecuteResponse response = port.execute(req);
异常(exception)情况:
03:07:26.227 [main] WARN o.a.c.w.p.AssertionBuilderRegistryImpl - No assertion builder for type {http://www.datapower.com/extensions}summary registered.
03:07:26.229 [main] WARN o.a.c.w.p.AssertionBuilderRegistryImpl - No assertion builder for type {http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200512}SignedParts registered.
03:07:26.232 [main] DEBUG o.a.cxf.ws.policy.PolicyEngineImpl - Alternative {http://www.datapower.com/extensions}summary is not supported
03:07:26.233 [main] DEBUG o.a.cxf.ws.policy.PolicyEngineImpl - Alternative {http://www.datapower.com/extensions}summary is not supported
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: None of the policy alternatives can be satisfied.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:161)
at com.sun.proxy.$Proxy33.execute(Unknown Source)
at tests.consultaPorRUT.main(consultaPorRUT.java:150)
Caused by: org.apache.cxf.ws.policy.PolicyException: None of the policy alternatives can be satisfied.
at org.apache.cxf.ws.policy.EndpointPolicyImpl.chooseAlternative(EndpointPolicyImpl.java:172)
at org.apache.cxf.ws.policy.EndpointPolicyImpl.finalizeConfig(EndpointPolicyImpl.java:146)
at org.apache.cxf.ws.policy.EndpointPolicyImpl.initialize(EndpointPolicyImpl.java:142)
at org.apache.cxf.ws.policy.PolicyEngineImpl.createEndpointPolicyInfo(PolicyEngineImpl.java:584)
at org.apache.cxf.ws.policy.PolicyEngineImpl.getEndpointPolicy(PolicyEngineImpl.java:313)
at org.apache.cxf.ws.policy.PolicyEngineImpl.getClientEndpointPolicy(PolicyEngineImpl.java:294)
at org.apache.cxf.ws.policy.PolicyDataEngineImpl.getClientEndpointPolicy(PolicyDataEngineImpl.java:61)
at org.apache.cxf.transport.http.HTTPConduit.updateClientPolicy(HTTPConduit.java:318)
at org.apache.cxf.transport.http.HTTPConduit.updateClientPolicy(HTTPConduit.java:338)
at org.apache.cxf.transport.http.HTTPConduit.getClient(HTTPConduit.java:855)
at org.apache.cxf.transport.http.HTTPConduit.configureConduitFromEndpointInfo(HTTPConduit.java:360)
at org.apache.cxf.transport.http.HTTPConduit.finalizeConfig(HTTPConduit.java:440)
at org.apache.cxf.transport.http.HTTPTransportFactory.getConduit(HTTPTransportFactory.java:242)
at org.apache.cxf.binding.soap.SoapTransportFactory.getConduit(SoapTransportFactory.java:222)
at org.apache.cxf.binding.soap.SoapTransportFactory.getConduit(SoapTransportFactory.java:229)
at org.apache.cxf.endpoint.AbstractConduitSelector.createConduit(AbstractConduitSelector.java:145)
at org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(AbstractConduitSelector.java:107)
at org.apache.cxf.endpoint.UpfrontConduitSelector.prepare(UpfrontConduitSelector.java:63)
at org.apache.cxf.endpoint.ClientImpl.prepareConduitSelector(ClientImpl.java:849)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:509)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:277)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139)
... 2 more
我需要如何解决此错误?
最佳答案
当 WSDL 中有安全策略时,您可以使用不同的方式来配置 WS-Security。您正在通过基于“操作”的方法配置 WS-Security。然而,查看 WSDL,该策略并不标准。因此,您可能最好保留当前配置,但为客户端代码编写一个拦截器来断言相关策略。
关于java - Apache CXF - 没有任何策略替代方案可以得到满足异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31376969/
我将Eclipse Helios Service Release 2版本用于apache cxf。当我转到windo->首选项-> Web服务-> CXF 2.x首选项,并设置cxf运行时时,版本和类
我是任何开放框架的新手(我是基于 java 的解决方案工程师)并试图构建一个 cxf 项目。 我知道我需要 applicationContext.xml文件和内容之类的
我想为不同的目的注册不同的类,以便在同一阶段调用 (Phase.PRE_INVOKE)。是否可以? 最佳答案 看这里http://cxf.apache.org/docs/interceptors.ht
我想使用 wsdl2java(CXF) 命令生成自定义包。 我的 WSDL 结构是: wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/w
我在通过 JAXRSClientFactoryBean.create 创建的 CXF 中有一个 JAX-RS 客户端。如何设置连接/接收超时? 我想我需要掌握管道,但不知道如何操作。这个项目没有使用
鉴于来自 fuse 源的 apache-servicemix-4.4.1-fuse-00-08 的“cxf-osgi”示例,使用 maven 3.0.3 构建,将其部署到 apache karaf 2
这个问题在这里已经有了答案: How do I fix a NoSuchMethodError? (33 个答案) 关闭 29 天前。 我刚刚尝试通过 Maven 使用 Apache CXF 和 S
我正在尝试使用 Apache CXF 开发一个 API 调用,该调用会随请求一起接收附件。我遵循了 this 教程,这就是我到目前为止所得到的。 @POST @Path("/upload") @Req
'org.apache.cxf.tools.wsdlto.WSDLToJava' 将 wsdl 转换为 java 类。 它是在内部使用 JAXB 吗?为什么这个命令能够生成类似于“xjc”创建的类?有
我已经使用 CXF 和 Spring 开发了一个 Java Web 服务。 由于安全原因,我想隐藏 WSDL,尽管 WS 仍然可用。 有没有办法使用 CXF 做到这一点? 最佳答案 您可以在 web.
我有一个生成的 JAXB 类(来自 XSD)。我能够以 XML 和 JSON 的形式返回,但是一旦我将 text/html 添加到我的 Produces 注释中,我就会得到: "No message
我创建了一个非常简单的基于 cxf 的非 spring Servlet,它加载了一个 javax.ws.rs.Application类型。 这是 web.xml: CXFSe
我正在使用 JBOSS EAP 6.2 来部署 restful web 服务。 restful web 服务使用 apache cxf,它取自 jboss eap。目前它使用 jar cxf-api-
我有一个服务方法定义为: public JaxbList getDeal() { List deals = new ArrayList(); Deal type = new Deal(
我需要将 wadl 转换为 java pojo,为此我已经下载了 apache cxf 3.0.1 版本。但是当我在命令提示符下运行 wadl2java bat 文件时,出现以下异常 D:\softw
这个问题在这里已经有了答案: 9年前关闭。 Possible Duplicate: Which maven2 artifacts are necessary to build a WS with CX
我想将一个简单的 CXF Jax-Ws 服务器部署到 ServiceMix。它只是一个同时具有服务接口(interface)和 impl 类的 OSGI 包。我需要将它部署到不同的 ServiceMi
是否可以在 wso2 ESB 中部署 CXF Web 服务? 目前我已经开始从 WSO2 User Guide 引用 wso2 的文档。我想将现有的 CXF Web 服务部署到 ESB。因此,有关这方
我想了解 cxf-bundle和 cxf-bundle-jaxrs jar 。它们是两个不同的 jar ,还是前者本身包含后者? 谢谢,巴蒂亚 最佳答案 前者包含后者。 但是,您实际上不应该使用其中任
我已经built and deployed a custom web services consumer in Java on Domino using the available CXF frame
我是一名优秀的程序员,十分优秀!