Ralf Brese created CXF-4623:
-------------------------------

             Summary: Marshalling Error during asynchronous service invocation 
when adding a soap header using a SOAPHandler
                 Key: CXF-4623
                 URL: https://issues.apache.org/jira/browse/CXF-4623
             Project: CXF
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.7.0
         Environment: Tested in Eclipse Helios on Win 7
            Reporter: Ralf Brese
            Priority: Critical


I am currently migrating a SOAP based client implementation from the JAX WS 
implementation included in Java 6 (Metro) to Apache CXF i.e. with Java 6 the 
code is fully functional but causes the described problem with Apache CXF 2.7.0.

The client uses asynchronous invocation of the WSDL services. When using 
synchronous invocation the code works fine.
The client uses a SOAPHandler to add a SOAP Header which contains some specific 
authentication information that is handled by the service.

The problem seems to be in the SoapOutInterceptor or at least in the handling 
of the SOAP header elements and the handling of the objects of the invocation.
In the method handleHeaderPart the SoapOutInterceptor retrieves a list of 
objects:
206: MessageContentsList objs = MessageContentsList.getContentsList(message);

This object list contains the parameter for the service call and in case of 
asynchronous invocation it contains also the callback object.
Afterwards when processing the headers in a loop the following check is done:
221: if (part.getIndex() >= objs.size()) {
222:  // The optional out of band header is not a part of parameters of the 
method
223:  continue;
224: }

The index of the header that has been added is 1. In case of the synchronous 
invocation the continue statement is executed because the objs variable only 
contains the one object that has been passed to the method. But in case of the 
asynchronous invocation the objs also contains the callback object and hence 
the continue statement is not executed but the SoapOutInterceptor tries to 
marshal the callback object which of cause fails.

Since my Client needs to use asynchronous message invocation for scalability 
reasons this problem is a blocking point for me and it would be of great help 
if even a workaround is available.




Here is the complete Exception stack:

08.11.2012 09:07:49 org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
WARNUNG: Interceptor for 
{http://symphonia.siemens.com/contactservice/generated/interf}Contactservice_Service#{http://symphonia.siemens.com/contactservice/generated/interf}findContactByName
 has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Marshalling Error: 
com.siemens.ucsolutions.ucsoapsdk.BaseDelegateAsyncHandler is not known to this 
context
        at 
org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:263)
        at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:168)
        at 
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleHeaderPart(SoapOutInterceptor.java:242)
        at 
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.writeSoapEnvelopeStart(SoapOutInterceptor.java:164)
        at 
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:81)
        at 
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:61)
        at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
        at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:531)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:457)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:435)
        at 
org.apache.cxf.jaxws.JaxWsClientProxy.invokeAsync(JaxWsClientProxy.java:267)
        at 
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:132)
        at $Proxy33.findContactByNameAsync(Unknown Source)
        at 
com.siemens.ucsolutions.ucsoapsdk.ContactServiceDelegate.findContactByNameAsync(ContactServiceDelegate.java:483)
        at 
com.siemens.ucsolutions.ucsoapsdk.ContactServiceDelegateTest.testFindContactByNameAsync(ContactServiceDelegateTest.java:515)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at junit.framework.TestCase.runTest(TestCase.java:164)
        at junit.framework.TestCase.runBare(TestCase.java:130)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:120)
        at 
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: javax.xml.bind.MarshalException
 - with linked exception:
[javax.xml.bind.JAXBException: 
com.siemens.ucsolutions.ucsoapsdk.BaseDelegateAsyncHandler is not known to this 
context]
        at 
com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:317)
        at 
com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:161)
        at 
org.apache.cxf.jaxb.JAXBEncoderDecoder.writeObject(JAXBEncoderDecoder.java:595)
        at 
org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:238)
        ... 30 more
Caused by: javax.xml.bind.JAXBException: 
com.siemens.ucsolutions.ucsoapsdk.BaseDelegateAsyncHandler is not known to this 
context
        at 
com.sun.xml.internal.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:214)
        at 
com.sun.xml.internal.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:229)
        at 
com.sun.xml.internal.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:133)
        at 
com.sun.xml.internal.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:116)
        at 
com.sun.xml.internal.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:304)
        at 
com.sun.xml.internal.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:311)
        at 
com.sun.xml.internal.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:61)
        at 
com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:462)
        at 
com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:314)
        ... 33 more
Caused by: javax.xml.bind.JAXBException: 
com.siemens.ucsolutions.ucsoapsdk.BaseDelegateAsyncHandler is not known to this 
context
        at 
com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:585)
        at 
com.sun.xml.internal.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:130)
        ... 39 more
09:07:49,694 ERROR [ContactServiceDelegateTest] handleResponse() Exception
java.util.concurrent.ExecutionException: org.apache.cxf.interceptor.Fault: 
Marshalling Error: com.siemens.ucsolutions.ucsoapsdk.BaseDelegateAsyncHandler 
is not known to this context
        at 
org.apache.cxf.jaxws.JaxwsClientCallback$2.get(JaxwsClientCallback.java:99)
        at 
com.siemens.ucsolutions.ucsoapsdk.ContactServiceDelegateTest$3.handleResponse(ContactServiceDelegateTest.java:521)
        at 
com.siemens.ucsolutions.ucsoapsdk.BaseDelegateAsyncHandler.handleResponse(BaseDelegateAsyncHandler.java:62)
        at 
org.apache.cxf.jaxws.JaxwsClientCallback.handleException(JaxwsClientCallback.java:87)
        at 
org.apache.cxf.interceptor.ClientOutFaultObserver.onMessage(ClientOutFaultObserver.java:59)
        at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:331)
        at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:531)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:457)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:435)
        at 
org.apache.cxf.jaxws.JaxWsClientProxy.invokeAsync(JaxWsClientProxy.java:267)
        at 
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:132)
        at $Proxy33.findContactByNameAsync(Unknown Source)
        at 
com.siemens.ucsolutions.ucsoapsdk.ContactServiceDelegate.findContactByNameAsync(ContactServiceDelegate.java:483)
        at 
com.siemens.ucsolutions.ucsoapsdk.ContactServiceDelegateTest.testFindContactByNameAsync(ContactServiceDelegateTest.java:515)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at junit.framework.TestCase.runTest(TestCase.java:164)
        at junit.framework.TestCase.runBare(TestCase.java:130)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:120)
        at 
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.apache.cxf.interceptor.Fault: Marshalling Error: 
com.siemens.ucsolutions.ucsoapsdk.BaseDelegateAsyncHandler is not known to this 
context
        at 
org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:263)
        at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:168)
        at 
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleHeaderPart(SoapOutInterceptor.java:242)
        at 
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.writeSoapEnvelopeStart(SoapOutInterceptor.java:164)
        at 
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:81)
        at 
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:61)
        at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
        ... 24 more
Caused by: javax.xml.bind.MarshalException
 - with linked exception:
[javax.xml.bind.JAXBException: 
com.siemens.ucsolutions.ucsoapsdk.BaseDelegateAsyncHandler is not known to this 
context]
        at 
com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:317)
        at 
com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:161)
        at 
org.apache.cxf.jaxb.JAXBEncoderDecoder.writeObject(JAXBEncoderDecoder.java:595)
        at 
org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:238)
        ... 30 more
Caused by: javax.xml.bind.JAXBException: 
com.siemens.ucsolutions.ucsoapsdk.BaseDelegateAsyncHandler is not known to this 
context
        at 
com.sun.xml.internal.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:214)
        at 
com.sun.xml.internal.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:229)
        at 
com.sun.xml.internal.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:133)
        at 
com.sun.xml.internal.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:116)
        at 
com.sun.xml.internal.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:304)
        at 
com.sun.xml.internal.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:311)
        at 
com.sun.xml.internal.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:61)
        at 
com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:462)
        at 
com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:314)
        ... 33 more
Caused by: javax.xml.bind.JAXBException: 
com.siemens.ucsolutions.ucsoapsdk.BaseDelegateAsyncHandler is not known to this 
context
        at 
com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:585)
        at 
com.sun.xml.internal.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:130)
        ... 39 more


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to