One Star

Talend ESB error with avax.wsdl.extensions.soap12

Hello,
I'm very new to OSGi but and don't know how to resolve this issue.
I have a SOAP client which runs fine as a stand-alone.
When I added it to a bundle and deploy in Talend ESB 4.2.1 I am getting this error msg:
java.lang.NoClassDefFoundError: javax.wsdl.extensions.soap12.SOAP12HeaderFault not found from bundle
Looking at my bundle list:
Apache ServiceMix :: Bundles :: wsdl4j (1.6.2.3) is active,
which seems to export the javax.wsdl.extensions.soap12 package so why is this class not found?

  • ESB
  • Talend Runtime
11 REPLIES
One Star

Re: Talend ESB error with avax.wsdl.extensions.soap12

If I stop the Apache ServiceMix :: Bundles :: wsdl4j (1.6.2.3) bundle, I now get the error msg:
java.lang.NoClassDefFoundError: Could not initialize class $Proxy100
The $Proxy variable ends with different numbers, its not always 100.
If I try to use my own bundle which would have the missing class:
wsdl4j (1.6.2)

I get the same error:
java.lang.NoClassDefFoundError: javax.wsdl.extensions.soap12.SOAP12HeaderFault not found from bundle
I seem stuck in the mud here.
Employee

Re: Talend ESB error with avax.wsdl.extensions.soap12

This looks very similar to some things I was hitting with CXF in OSGi two weeks ago, but it seemed to only occur for me when the OSGi/Karaf container was set to use Felix, not Equinox. Can you double check which OSGi framework you are using? If not Equinox, definitely try that.
As a workaround, you can likely add a Require-BundleSmiley Surprisedrg.apache.servicemix.bundles.wsdl4j entry to you manifest. Not a great solution, but it may help get over this.
One Star

Re: Talend ESB error with avax.wsdl.extensions.soap12

Thanks Dan,
that work-around worked.
I'm now getting this error:
$Proxy112 cannot be cast to com.sun.xml.ws.developer.WSBindingProvider
caused by this code:
WSBindingProvider bindingProvider = ((WSBindingProvider) port);
But that is a problem that seems to be related to the way the stubs were generated from the SalesForce wsdl with wsdl2java so I'm investigating that.
One Star

Re: Talend ESB error with avax.wsdl.extensions.soap12

I've switched to Equinox, but I'm still getting the same error:
$Proxy109 cannot be cast to com.sun.xml.ws.developer.WSBindingProvider
This same code is already tested and works as a CXF SOAP client, so there doesn't seem to be a problem with the stubs generated from the wsdl.
So I'm not sure why this isn't working inside an OSGi bundle.
The wsdl gets loaded and an object gets created that extends javax.xml.ws.Service.
From this object the getPort() method gets called, and then it tries to cast the resulting object to a com.sun.xml.ws.developer.WSBindingProvider in order to add some header info.
This fails inside Talend ESB with the above error.
Since I built the SOAP client code from example code from SalesForce.com, I am curious is other people have also encountered problems like this when trying to get a SalesForce SOAP client working inside an OSGi bundle?
One Star

Re: Talend ESB error with avax.wsdl.extensions.soap12

Here's the exception msg from the karaf logs:
javax.ws.rs.WebApplicationException
at com.cn.dsa.sf.server.SfProcessor.generateErrorResponse(SfProcessor.java:41)
at com.cn.dsa.sf.server.SfProcessor.process(SfProcessor.java:83)
at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:174)
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:299)
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)
at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:273)
at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:109)
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:77)
at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
at org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.asyncInvoke(CxfRsInvoker.java:95)
at org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.performInvocation(CxfRsInvoker.java:61)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:164)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:91)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:319)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:287)
at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:939)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:875)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:247)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
at org.eclipse.jetty.server.Server.handle(Server.java:346)
at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:589)
at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1048)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:601)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:214)
at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:535)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)
at java.lang.Thread.run(Thread.java:680)
Employee

Re: Talend ESB error with avax.wsdl.extensions.soap12

$Proxy112 cannot be cast to com.sun.xml.ws.developer.WSBindingProvider

That cast would only work if you are using the Sun reference implementation of JAX-WS, not CXF which is what we use in the ESB. That is a proprietary class from the reference implementation. The code that uses that would need to be adjusted to use the CXF API's. There is some information about that in the CXF FAQ:

http://cxf.apache.org/faq.html#FAQ-HowcanIaddsoapheaderstotherequest%2Fresponse%3F
One Star

Re: Talend ESB error with avax.wsdl.extensions.soap12

thanks for helping out a newbie.
I see now what you mean and am trying to rewrite example code from Salesforce so it does not use any packages from com.sun.*
The only obstacle I can't get around is setting the session ID.
I have been searching force.com all afternoon for examples on how to set the session ID without using the setOutBoundHeaders method which is only on com.sun.xml.ws.developer.WSBindingProvider. All the examples also use the com.sforce.soap.enterprise.SessionHeader for the session ID value!
SalesForce is popular enough that there must be example code somewhere of how to make a SOAP client for their service using just CXF which will work inside Talend ESB?
example:
//set session ID

SessionHeader sh = new SessionHeader();
sh.setSessionId(loginResponse.getSessionId());

JAXBContext jc;
try {
jc = JAXBContext.newInstance("com.sforce.soap.enterprise");
} catch (JAXBException e) {
exceptionLogger("Error creating JAXBContext instance ", e);
throw new WebServiceException(e);
}
wsBindingProvider.setOutboundHeaders(Headers.create((JAXBRIContext) jc, sh));
Employee

Re: Talend ESB error with avax.wsdl.extensions.soap12

Are you generating the code manually from the salesforce wsdl using the CXF wsdl2java tooling or wsimport?
If so, this MAY be even easier than you think. For CXF, add "-exsh true" flag. For wsimport, add -XadditionalHeaders. That will change then method signatures to actually add a parameter to the method for the headers. You won't need to mess with the BindingProvider and header lists or anything. Definitely the easiest thing to do, IMO.
If you don't want to do that, then you can try setting the header manually like you are trying to do. I'm not completely familliar with the SalesForce wsdl, so this is just mostly pseudo code:
SessionHeader sh = new SessionHeader();
sh.setSessionId(loginResponse.getSessionId());
List
headers = new ArrayList
();
Header dummyHeader = new Header(new QName("http://salesforce.com/header", "Session"), sh,
new JAXBDataBinding(SessionHeader.class));
headers.add(sessionHeader);
((BindingProvider)proxy).getRequestContext().put(Header.HEADER_LIST, headers);

Put the correct QName in there.
One Star

Re: Talend ESB error with avax.wsdl.extensions.soap12

I'm using wsdl2java, and have run it with the -exsh true extraarg, which I saw on some examples.
But I actually don't know how to use the improved methods to add the session ID to a soap query.
(duh, yup, newbie)
Regarding the Header code, I did try what you suggested earlier:
Header sessionIdHeader = new Header(new QName("urn:sobject.enterprise.soap.sforce.com", "sessionId"), sessionID, new JAXBDataBinding(String.class));

But I get the same invalid session ID msg. I think the problem is that the SOAP header has a child node as the sessionID value, and is also a child of sessionHeader:


xmlns:ns1="urn:enterprise.soap.sforce.com">

xmlns:ns2="urn:enterprise.soap.sforce.com">WgMUbbkPmBoH_dI9Z89Nvxm6ojXlNKOSUns2:sessionId>


(hmmm, maybe I should get rid of "sobject." in my URN?)
source: http://www.salesforce.com/us/developer/resources/soap/sforce60/sforce_API_messages_query.html


This appears to be a working example by someone using Axis objects, and I was considering the idea of re-creating this using CXF and JAX-WS objects but haven't any luck with that idea yet:

//Create a new session header object and set the session id to that returned by the login
SOAPHeaderElementAxisImpl header =
new SOAPHeaderElementAxisImpl(new SforceServiceLocator().getServiceName().getNamespaceURI(),
"SessionHeader");
SOAPElement node = header.addChildElement("sessionId");
node.addTextNode(loginResult.getSessionId());
bindingProvider.setHeader(header);
Employee

Re: Talend ESB error with avax.wsdl.extensions.soap12

You're on the right track, but use the generated SessionHeader object:

SessionHeader sh = new SessionHeader();
sh.setSessionId(loginResponse.getSessionId());
List
headers = new ArrayList
();
Header dummyHeader = new Header(new QName("urn:enterprise.soap.sforce.com", "SessionHeader"), sh,
new JAXBDataBinding(SessionHeader.class));
headers.add(sessionHeader);
One Star

Re: Talend ESB error with avax.wsdl.extensions.soap12

WORKED!
I owe you a beer Dan, next time you come down to visit NYC . . .
thanks!

miles