Glen, Thanks for quick response. I tried a couple of ways to add SOAPHeader, including SOAPHandler, all worked fine in stand alone. The problem is once the jars in Wephere 6.1 are included, variety of errors are thrown. I can't get rid of those jars. For using SOAPHandler, the error is : Mar 9, 2012 2:25:59 PM org.apache.cxf.phase.PhaseInterceptorChain doIntercept WARNING: Interceptor has thrown exception, unwinding now org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted. at org.apache.xerces.dom.CoreDocumentImpl.insertBefore(Unknown Source) at org.apache.xerces.dom.NodeImpl.appendChild(Unknown Source) at com.ibm.ws.webservices.engine.xmlsoap.SOAPPart.appendChild(SOAPPart.java:282) at org.apache.cxf.staxutils.W3CDOMStreamWriter.setChild(W3CDOMStreamWriter.java:114) at org.apache.cxf.staxutils.W3CDOMStreamWriter.newChild(W3CDOMStreamWriter.java:104) at org.apache.cxf.staxutils.W3CDOMStreamWriter.writeStartElement(W3CDOMStreamWriter.java:132) at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.writeSoapEnvelopeStart(SoapOutInterceptor.java:121) at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:80) at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:61) 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 $Proxy38.createProgram100(Unknown Source) at client.glen.mazzas.WSClient.main(WSClient.java:83) javax.xml.ws.soap.SOAPFaultException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted. at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:146) at $Proxy38.createProgram100(Unknown Source) at client.glen.mazzas.WSClient.main(WSClient.java:83)
--- On Fri, 3/9/12, Glen Mazza (Talend) [via CXF] <[email protected]> wrote: From: Glen Mazza (Talend) [via CXF] <[email protected]> Subject: Re: cxf 2.2.5 ws client in websphere v6.1, got ClassCastException error To: "yuplushu" <[email protected]> Date: Friday, March 9, 2012, 11:44 AM 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 If you reply to this email, your message will be added to the discussion below:http://cxf.547215.n5.nabble.com/cxf-2-2-5-ws-client-in-websphere-v6-1-got-ClassCastException-error-tp5551164p5551302.html To unsubscribe from cxf 2.2.5 ws client in websphere v6.1, got ClassCastException error, click here. NAML -- View this message in context: http://cxf.547215.n5.nabble.com/cxf-2-2-5-ws-client-in-websphere-v6-1-got-ClassCastException-error-tp5551164p5551665.html Sent from the cxf-user mailing list archive at Nabble.com.
