Hello Freeman/Dan!, thanks for your help. I changed the value, but the error continue. I inspect the transmission with wireshark and I saw "text/xml; charset=UTF-8" as content type. I tried changing to both SAAJOutInterceptor and both WSS4JOutInterceptor and no news. In the last case the exception says "No security action was defined.".
I search through the code to find out some annotation indicating the content type.. but noting yet. Some idea? Thanks! 2010/12/15 Daniel Kulp <[email protected]> > > The line: > > <property name="bindingId" > > value="http://apache.org/cxf/binding/http" /> > > is configuring it as the xml/http binding, not SOAP. Thus, the soap > related > interceptors won't work. > > Dan > > > On Wednesday 15 December 2010 1:24:58 pm Juan Pablo Pizarro wrote: > > Hello All, I'm trying to call a web service with Spring+CXF. The result > is > > a exception java.lang.ClassCastException: > > org.apache.cxf.message.XMLMessage cannot be cast to > > org.apache.cxf.binding.soap.SoapMessage. My configuration is: > > > > > > <?xml version="1.0" encoding="UTF-8"?> > > <beans xmlns="http://www.springframework.org/schema/beans" > > xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:xsi=" > > http://www.w3.org/2001/XMLSchema-instance" > > xsi:schemaLocation="http://www.springframework.org/schema/beans > > http://www.springframework.org/schema/beans/spring-beans.xsd > > http://cxf.apache.org/jaxws > > http://cxf.apache.org/schemas/jaxws.xsd"> > > > > <import resource="classpath:META-INF/cxf/cxf.xml" /> > > <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> > > <import > > resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml" /> > > <import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> > > > > <bean id="wsclient" class="org.tempuri.IStock" > factory-bean="wsFactory" > > factory-method="create" /> > > > > <bean id="wsFactory" > > class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean"> <property > > name="serviceClass" value="org.tempuri.IStock" /> <property > name="address" > > value="http://wss.aduanas.gub.uy/LuciaWsSecurity/Stock.svc" > /> > > <property name="outInterceptors"> > > <list> > > <bean > > class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor" /> > > <ref bean="wss4jOutInterceptor" /> > > </list> > > </property> > > <property name="bindingId" > > value="http://apache.org/cxf/binding/http" /> > > <property name="transportId" value=" > > http://schemas.xmlsoap.org/wsdl/soap/http" /> > > </bean> > > > > <bean id="wss4jOutInterceptor" > > class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor"> > > <constructor-arg> > > <map> > > <entry key="action" value="Signature Timestamp" /> > > <entry key="signaturePropFile" > > value="Client_Sign.properties" /> > > <entry key="user" > > value="le-60dca1be-6392-48b3-bbc2-0dfb1ab41d25" /> > > <entry key="passwordCallbackRef"> > > <ref bean="signaturePwdCallback" /> > > </entry> > > </map> > > </constructor-arg> > > </bean> > > > > <bean id="signaturePwdCallback" > > class="org.jpp.ws.client.ClientCallback" /> > > </beans> > > > > > > Somebody knows the reason? There are some example/tutorial to avoid the > > error? > > > > > > Thanks!! > > > > > > > > > > WARNING: Interceptor for { > > http://tempuri.org/}IStockService#{http://tempuri.org/}MensajeStock<http://tempuri.org/%7DIStockService#%7Bhttp://tempuri.org/%7DMensajeStock>has > > thrown exception, unwinding now > > java.lang.ClassCastException: org.apache.cxf.message.XMLMessage cannot be > > cast to org.apache.cxf.binding.soap.SoapMessage > > at > > > org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor.handleMessage(SAAJOutIn > > terceptor.java:70) at > > > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChai > > n.java:247) at > > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516) at > > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313) at > > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265) at > > org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) at > > org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124) > > at $Proxy36.mensajeStock(Unknown Source) > > at org.jpp.ws.client.Client.main(Client.java:65) > > Dec 15, 2010 4:19:51 PM org.apache.cxf.phase.PhaseInterceptorChain unwind > > WARNING: Exception in handleFault on interceptor > > org.apache.cxf.binding.soap.saaj.saajoutintercep...@57f7cdc7 > > java.lang.ClassCastException: org.apache.cxf.message.XMLMessage cannot be > > cast to org.apache.cxf.binding.soap.SoapMessage > > at > > > org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor.handleFault(SAAJOutInte > > rceptor.java:70) at > > > org.apache.cxf.phase.PhaseInterceptorChain.unwind(PhaseInterceptorChain.jav > > a:411) at > > > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChai > > n.java:294) at > > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516) at > > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313) at > > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265) at > > org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) at > > org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124) > > at $Proxy36.mensajeStock(Unknown Source) > > at org.jpp.ws.client.Client.main(Client.java:65) > > Exception in thread "main" javax.xml.ws.http.HTTPException > > at > > org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:138) > > at $Proxy36.mensajeStock(Unknown Source) > > at org.jpp.ws.client.Client.main(Client.java:65) > > Caused by: java.lang.ClassCastException: > org.apache.cxf.message.XMLMessage > > cannot be cast to org.apache.cxf.binding.soap.SoapMessage > > at > > > org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor.handleFault(SAAJOutInte > > rceptor.java:70) at > > > org.apache.cxf.phase.PhaseInterceptorChain.unwind(PhaseInterceptorChain.jav > > a:411) at > > > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChai > > n.java:294) at > > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516) at > > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313) at > > org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265) at > > org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) at > > org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124) > > ... 2 more > > -- > Daniel Kulp > [email protected] > http://dankulp.com/blog >
