CXF webservice client throws IllegalArgumentException Algorithm suite "Basic128Exn256" is not registered - cxf

Looking for guidance on CXF webservice client
Cxf version: 3.2.1
Web service client is a standalone java program. No web server configured.
I have wsdl file from the service provider which has
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic128Exn256/>
</wsp:Policy>
</sp:AlgorithmSuite>
within <wsp:Policy> tag.
However, when starting cxf client, I get an exception as follows
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)
Same wsdl, when I write a pure jax-ws client without cxf, it works.
Any help is appreciated

"Basic128Exn256" is not a standard algorithm suite that is defined in the specs. If you want to support it in CXF you'll have to write a custom AlgorithmSuite (e.g. http://coheigea.blogspot.ie/2011/09/specifying-custom-algorithmsuite.html)

Related

CXF 3.5.5 Client API - causes java.lang.IncompatibleClassChangeError: org.apache.cxf.common.util.ASMHelper

I'm trying to use CXF 3.5.5 API for creating a WebClient to be able to invoke the CXF REST API.
When I create a WebClient, in CXF 3.5.5 , it gives the following exception.
While WebClient.create method is invoked in cxf 3.5.5, the ClassLoader throws Exception:
Caused by: java.lang.IncompatibleClassChangeError: org.apache.cxf.common.util.ASMHelper
This was working with CXF 3.3.7 version.
Any help is highly appreciated.
I'm trying to invoke the CXF REST API using CXF Client API WebClient.
List<Object> providers = new ArrayList<Object>();
providers.add(new com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider());
WebClient client = WebClient.create(serviceURL, providers);
client.encoding("UTF-8");
client.type(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON);
While WebClient.create method is invoked in cxf 3.5.5, the ClassLoader throws Exception:
Caused by: java.lang.IncompatibleClassChangeError: org.apache.cxf.common.util.ASMHelper

Log soap request and response using apache-cxf

I am working on Maven project in Intellij.I have generated wsdl to java using cxf-codegen-plugin. I have created a client and created a tester.java to test the client. I have to log the soap request and response. I have one cxf.xml, config.properties and a client.java files. I am not sure where to configure to log the soap messages. Also i have less idea about webservices. I have also copied log4j.xml to my METAINF.
I have tried all possible scenarios in stack overflow. Not sure which is going wrong.
Assuming you have the latest version of CXF (or fairly recent), the easiest way is to enable the logging feature on the CXF bus in the cxf.xml:
...
<cxf:bus>
<cxf:features>
<cxf:logging/>
</cxf:features>
</cxf:bus>
...
or only on your jaxws endpoint:
<jaxws:endpoint...>
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature"/>
</jaxws:features>
</jaxws:endpoint>
Make sure you have cxf-rt-features-logging-XXX.jar on your classpath (XXX = your version of CXF).
And configure logging as described here:
http://cxf.apache.org/docs/general-cxf-logging.html
You need to be in INFO level at least.

Get Exception Caused By: java.lang.RuntimeException: Cannot create a secure XMLInputFactory with CXF 2.7.11 JAX-RS

I am try to use CXF 2.7.11 and Spring to develop Restfull web service. get this Cannot create a secure XMLInputFactory when try to implement JAX-RS Security
Caused By:
java.lang.RuntimeException: Cannot create a secure XMLInputFactory
at org.apache.cxf.staxutils.StaxUtils.createXMLInputFactory(StaxUtils.java:314)
at org.apache.cxf.staxutils.StaxUtils.getXMLInputFactory(StaxUtils.java:264)
at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1549)
at org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:1122)
at
org.apache.cxf.transport.http_jetty.spring.JettySpringTypesFactory.createTLSServerParametersMap(JettyS
pringTypesFactory.java:101)
WEB-INF/lib floder contain the following jar
asm-3.3.1.jar
commons-codec-1.9.jar
commons-collections-3.2.1.jar
commons-lang-2.6.jar
commons-logging-1.1.1.jar
commons-logging-1.1.jar
cxf-2.7.11.jar
cxf-bundle-jaxrs-2.7.11.jar
cxf-manifest.jar
geronimo-activation_1.1_spec-1.1.jar
geronimo-javamail_1.4_spec-1.7.1.jar
geronimo-jaxws_2.2_spec-1.1.jar
geronimo-stax-api_1.0_spec-1.0.1.jar
geronimo-ws-metadata_2.0_spec-1.1.3.jar
javax.ws.rs-api-2.0-m10.jar
jaxb-api-2.2.5.jar
jaxb-impl-2.2.5.1.jar
jetty-server-8.1.14.v20131031.jar
jetty-util-8.1.14.v20131031.jar
neethi-3.0.3.jar
ojdbc6.jar
spring-aop-3.2.6.RELEASE.jar
spring-beans-3.2.6.RELEASE.jar
spring-context-3.2.6.RELEASE.jar
spring-core-3.2.6.RELEASE.jar
spring-expression-3.2.6.RELEASE.jar
spring-jdbc-3.2.6.RELEASE.jar
spring-jms-3.2.6.RELEASE.jar
spring-tx-3.2.6.RELEASE.jar
spring-web-3.2.6.RELEASE.jar
stax2-api-3.1.4.jar
woodstox-core-asl-4.2.1.jar
wsdl4j-1.6.3.jar

having issues deploying grails project with cxf plugin onto WAS 8

I am fairly new to groovy/grails and trying to deploy a grails app(WAR file) which uses Grails 2.1.1 and CXF plugin 1.0.1 to WebSphere 8.
This is the first time I am deploying Grails 2.1.1 app to WebSphere 8, with CXF plugin for SOAP based Web Services and I am running into some issues. Same app deploys and works fine locally on Tomcat and I am able to get to my web service and access WSDL file.
Anyone had this issues or know what could be the issue, please help. Here is the stack trace:
Original Exception:
Error Message: javax.servlet.ServletException: Filter [sitemesh]: could not be initialized
Error Code: 500
Target Servlet: CxfServlet
Error Stack:
com.opensymphony.module.sitemesh.factory.FactoryException: Could not initialize DecoratorMapper : org.codehaus.groovy.grails.web.sitemesh.GrailsLayoutDecoratorMapper: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'groovyPageLayoutFinder' is defined
at com.opensymphony.module.sitemesh.factory.BaseFactory.pushDecoratorMapper(BaseFactory.java:117)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.loadDecoratorMappers(Grails5535Factory.java:231)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.loadConfig(Grails5535Factory.java:98)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.<init>(Grails5535Factory.java:66)
at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.init(GrailsPageFilter.java:83)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:145)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:568)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:475)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:308)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:380)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:892)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1025)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3704)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:962)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1659)
Root cause:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'groovyPageLayoutFinder' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1095)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:277)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1102)
at org.codehaus.groovy.grails.web.sitemesh.GrailsLayoutDecoratorMapper.init(GrailsLayoutDecoratorMapper.java:48)
at com.opensymphony.module.sitemesh.factory.BaseFactory.pushDecoratorMapper(BaseFactory.java:110)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.loadDecoratorMappers(Grails5535Factory.java:231)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.loadConfig(Grails5535Factory.java:98)
at org.codehaus.groovy.grails.web.sitemesh.Grails5535Factory.<init>(Grails5535Factory.java:66)
at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.init(GrailsPageFilter.java:83)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:145)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:568)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:475)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:308)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:380)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:892)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1025)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3704)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:962)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1659) a
Try to add the following to your BuildConfig.groovy to exclude the JAXB implementation and Apache serializer related libraries.
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
excludes ("serializer", "jaxb-impl")
}
...
}
Then rebuild your war to see if it works.
If everything is working fine on Tomcat, it sounds like a librairy conflict with IBM Websphere.
Be sure to configure the classloader to Parent last so that your application will override WAS librairy.

CXF Weblogic - Override CXF logger to Slf4j

We are using Apache CXF 2.5.2 for webservice client proxies. We use weblogic 10.3.4. To override the CXF logger we use the following option:
-Dorg.apache.cxf.Logger=org.apache.cxf.common.logging.Slf4jLogger
For the org.apache.cxf.common.logging.Slf4jLogger, we've included the cxf-common-utilities-2.5.2 in our build.
When we try to deploy to weblogic we get the following exception:
[ERROR] Target state: deploy failed on Server AdminServer
[ERROR] java.lang.NoClassDefFoundError: weblogic/wsee/jaxws/spi/WLSProvider
According to documentation, your WebService client should have wseeclient.jar as it's runtime dependency. If the problems is still there, then include wlfullclient.jar (see Creating a wlfullclient.jar for JDK 1.6 client applications ).

Resources