Not to say that it doesn't exist, but I haven't seen that way of adding SOAP Headers before (it almost looks like a way to add HTTP headers instead). Links #43 and #44 here: http://www.jroller.com/gmazza/entry/blog_article_index show alternative ways of adding SOAP headers using interceptors or JAX-WS Handlers. If no one else can fix your code below you may wish to look at those methods.

Regards,
Glen

On 03/09/2012 11:49 AM, yuplushu wrote:
CXF 2.2.5 client call web service operation from ear that deployed to
webphere application server v6.1. It works fine untill a SOAP header is
added as:

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document d = db.newDocument();
Element dummy = d.createElement("dummy");
dummy.setTextContent("Dummy Header");
Header dummyHeader = new Header(new QName("urn:dummySpace", "dummyHeader"),
dummy);
List<Header>  headersList = new ArrayList<Header>();
headersList.add(dummyHeader);
bindingProvider.getRequestContext().put(Header.HEADER_LIST, headersList);

Then get error:

PhaseIntercep W org.apache.cxf.phase.PhaseInterceptorChain doIntercept
Interceptor has thrown exception, unwinding now
                                  java.lang.ClassCastException:
org.apache.cxf.headers.Header incompatible with
org.apache.cxf.headers.Header
        at
org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor.handleMessage(SoapHeaderOutFilterInterceptor.java:40)
        at
org.apache.cxf.binding.soap.interceptor.SoapHeaderOutFilterInterceptor.handleMessage(SoapHeaderOutFilterInterceptor.java:29)
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:483)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:309)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:261)
        at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
        at 
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
        at $Proxy290.createProgram100(Unknown Source)

I can't find any other cxf jars except cxf-2.2.5.jar.
Also can't change class loader to "PARENT_LAST" because the app
infrastructure requires "PAREAN_FIRST".
Any suggstion to work around it?

--
View this message in context: 
http://cxf.547215.n5.nabble.com/cxf-2-2-5-ws-client-in-websphere-v6-1-got-ClassCastException-error-tp5551164p5551164.html
Sent from the cxf-user mailing list archive at Nabble.com.


--
Glen Mazza
Talend Community Coders - coders.talend.com
blog: www.jroller.com/gmazza

Reply via email to