寻找有关CXF网络服务客户端的指南
Cxf版本:3.2.1 Web服务客户端是一个独立的Java程序。没有配置Web服务器。
我有来自服务提供商的wsdl文件
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic128Exn256/>
</wsp:Policy>
</sp:AlgorithmSuite>
在<wsp:Policy>
标记内。
但是,启动cxf客户端时,我得到如下例外
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Algorithm suite "Basic128Exn256" is not registered
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:161)
at com.sun.proxy.$Proxy50.importAndLoadData(Unknown Source)
at temp.test.SoapServiceTest.main(SoapServiceTest.java:70)
Caused by: java.lang.IllegalArgumentException: Algorithm suite "Basic128Exn256" is not registered
at org.apache.cxf.ws.security.policy.custom.AlgorithmSuiteBuilder.build(AlgorithmSuiteBuilder.java:68)
at org.apache.cxf.ws.security.policy.custom.AlgorithmSuiteBuilder.build(AlgorithmSuiteBuilder.java:37)
at org.apache.neethi.AssertionBuilderFactoryImpl.invokeBuilder(AssertionBuilderFactoryImpl.java:138)
at org.apache.neethi.AssertionBuilderFactoryImpl.build(AssertionBuilderFactoryImpl.java:117)
at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:224)
at org.apache.neethi.PolicyBuilder.getPolicyOperator(PolicyBuilder.java:174)
at org.apache.neethi.PolicyBuilder.getPolicy(PolicyBuilder.java:108)
at org.apache.wss4j.policy.builders.SymmetricBindingBuilder.build(SymmetricBindingBuilder.java:44)
at org.apache.wss4j.policy.builders.SymmetricBindingBuilder.build(SymmetricBindingBuilder.java:34)
at org.apache.neethi.AssertionBuilderFactoryImpl.invokeBuilder(AssertionBuilderFactoryImpl.java:138)
at org.apache.neethi.AssertionBuilderFactoryImpl.build(AssertionBuilderFactoryImpl.java:117)
at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:224)
at org.apache.neethi.PolicyBuilder.getAllOperator(PolicyBuilder.java:184)
at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:217)
at org.apache.neethi.PolicyBuilder.getExactlyOneOperator(PolicyBuilder.java:180)
at org.apache.neethi.PolicyBuilder.processOperationElement(PolicyBuilder.java:215)
at org.apache.neethi.PolicyBuilder.getPolicyOperator(PolicyBuilder.java:174)
at org.apache.neethi.PolicyBuilder.getPolicy(PolicyBuilder.java:124)
at org.apache.cxf.ws.policy.attachment.reference.LocalServiceModelReferenceResolver.resolveReference(LocalServiceModelReferenceResolver.java:53)
at org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.resolveLocal(Wsdl11AttachmentPolicyProvider.java:292)
at org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.resolveReference(Wsdl11AttachmentPolicyProvider.java:272)
at org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.getElementPolicy(Wsdl11AttachmentPolicyProvider.java:220)
at org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.getElementPolicy(Wsdl11AttachmentPolicyProvider.java:168)
at org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.getElementPolicy(Wsdl11AttachmentPolicyProvider.java:161)
at org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.getEffectivePolicy(Wsdl11AttachmentPolicyProvider.java:98)
at org.apache.cxf.ws.policy.PolicyEngineImpl.getAggregatedEndpointPolicy(PolicyEngineImpl.java:464)
at org.apache.cxf.ws.policy.EndpointPolicyImpl.initializePolicy(EndpointPolicyImpl.java:152)
at org.apache.cxf.ws.policy.EndpointPolicyImpl.initialize(EndpointPolicyImpl.java:140)
at org.apache.cxf.ws.policy.PolicyEngineImpl.createEndpointPolicyInfo(PolicyEngineImpl.java:604)
at org.apache.cxf.ws.policy.PolicyEngineImpl.getEndpointPolicy(PolicyEngineImpl.java:316)
at org.apache.cxf.ws.policy.PolicyEngineImpl.getClientEndpointPolicy(PolicyEngineImpl.java:303)
at org.apache.cxf.ws.policy.PolicyDataEngineImpl.getClientEndpointPolicy(PolicyDataEngineImpl.java:61)
at org.apache.cxf.transport.http.HTTPConduit.updateClientPolicy(HTTPConduit.java:325)
at org.apache.cxf.transport.http.HTTPConduit.updateClientPolicy(HTTPConduit.java:345)
at org.apache.cxf.transport.http.HTTPConduit.getClient(HTTPConduit.java:879)
at org.apache.cxf.transport.http.HTTPConduit.configureConduitFromEndpointInfo(HTTPConduit.java:367)
at org.apache.cxf.transport.http.HTTPConduit.finalizeConfig(HTTPConduit.java:447)
at org.apache.cxf.transport.http.HTTPTransportFactory.getConduit(HTTPTransportFactory.java:248)
at org.apache.cxf.binding.soap.SoapTransportFactory.getConduit(SoapTransportFactory.java:226)
at org.apache.cxf.binding.soap.SoapTransportFactory.getConduit(SoapTransportFactory.java:233)
at org.apache.cxf.endpoint.AbstractConduitSelector.createConduit(AbstractConduitSelector.java:146)
at org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(AbstractConduitSelector.java:108)
at org.apache.cxf.endpoint.UpfrontConduitSelector.prepare(UpfrontConduitSelector.java:63)
at org.apache.cxf.endpoint.ClientImpl.prepareConduitSelector(ClientImpl.java:853)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:511)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:425)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:326)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:279)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139)
相同的wsdl,当我编写一个没有cxf的纯jax-ws客户端时,它可以工作。 任何帮助表示赞赏
答案 0 :(得分:0)
&#34; Basic128Exn256&#34;不是规范中定义的标准算法套件。如果您想在CXF中支持它,您必须编写自定义AlgorithmSuite(例如http://coheigea.blogspot.ie/2011/09/specifying-custom-algorithmsuite.html)