By default, CXF streams the messages and does not build up an SAAJ model
(which would consume memory and such). If you need/want the SAAJ model like
that, you would need to configure in the SAAJOutInterceptor and likely move
your interceptor later in the chain.
Dan
On Wednesday, June 22, 2011 7:37:33 PM GerryChenStarNet wrote:
> Hi Everyone!
>
> I have recently studied CXF in this forums. I have some questions. I need
> some help.
>
> I use cxf 2.4.0I and I wrote a Interceptor that inster into outgoing chain.
> The program did not report the errors when it ran. But the method
> (handleMessage) of my Interceptor can't get any Soap content when I debuged
> it.
>
>
> My program is as followed:
>
> File:MySoapInterceptorImpl.java
> ************************************************************************
> public class MySoapInterceptorImpl extends AbstractSoapInterceptor
> implements
>
> IMySoapInterceptor {
>
> public MySoapInterceptorImpl()
> {
> super(Phase.WRITE );
> addAfter(SoapOutInterceptor.class.getName());
> }
>
>
> public void handleMessage(SoapMessage msg) throws Fault {
>
> // TODO Auto-generated method stub
> String soapContent ;
> SOAPMessage sm = msg.getContent(SOAPMessage.class);
> * /*sm always is null*/*
>
> }
>
> }
>
>
> ******************************************
>
>
> bean.xml
>
> <bean id="myOutSoapInterceptor"
> class="**.***.service.interceptorimpl.MySoapInterceptorImpl"/>
>
> <jaxws:endpoint id="helloWorld"
> implementor="**.*****.service.helloimpl.HelloServiceImpl"
> address="/HelloWorld">
>
> <jaxws:properties>
> <entry key="soap.env.ns.map">
> <map>
> <entry key="SOAP-ENV"
> value="http://schemas.xmlsoap.org/soap/envelope/"/>
>
> <entry key="SOAP-ENC"
> value="http://schemas.xmlsoap.org/soap/encoding/"/>
> <entry key="xsd"
> value="http://www.w3.org/2001/XMLSchema"/>
>
> <entry key="xsi"
> value="http://www.w3.org/2001/XMLSchema-instance"/>
> <entry key="cwmp" value="urn:dslforum-org:cwmp-1-0"/>
>
> </map>
> </entry>
> <entry key="disable.outputstream.optimization" value="true"/>
> </jaxws:properties>
>
> </jaxws:endpoint>
>
>
> <cxf:bus>
> <cxf:outInterceptors>
> <ref bean="myOutSoapInterceptor"/>
> </cxf:outInterceptors>
> </cxf:bus>
> ********************************************************
>
> webService Impl file :HelloServiceImpl.class
>
> @WebService(endpointInterface = "**.****.service.hello.IHelloService")
> public class HelloServiceImpl implements IHelloService {
>
> public String sayHello(String msg) {
>
> // TODO Auto-generated method stub
>
> System.out.println("Hello " + msg);
> return "Hello "+msg+"!";
> }
>
> }
>
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/CXF-Interceptor-get-Soap-Message-is-null-tp
> 4516145p4516145.html Sent from the cxf-user mailing list archive at
> Nabble.com.
--
Daniel Kulp
[email protected]
http://dankulp.com/blog
Talend - http://www.talend.com