Hi,

I have a webapp using CXF and  Spring,i am tryng to put an interceptor in
order to get parameters from Soap Header

I don't really have problem  with interceptor and its configuration

My main problem occurs when i'am tryng to get message from SoapMessage
class, especially for parameters which are contained in header. (See example
below userName parameter)

Can you tell me how i must use the message parameter in handleMessage
method?
Did i forget anything ?


Here is the  message soap sent :

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:spr="http://springtest.***.com/";>
   <soapenv:Header>
 
         <userName>John Doe</userName>
 
   </soapenv:Header>
   <soapenv:Body>
      <spr:oneMethod>
         <!--Optional:-->
         <arg0>10</arg0>
         <!--Optional:-->
         <arg1>20</arg1>
      </spr:oneMethod>
   </soapenv:Body>
</soapenv:Envelope>

interceptor class:


public class TestInterceptor extends AbstractSoapInterceptor{
        String userConnected="";
        
          public TestInterceptor() {
                    super(Phase.READ);
                  }
 
 
        @Override
        public void handleMessage(SoapMessage message) {
                System.out.println("interceptor");
 
                List<Header> headers=message.getHeaders();
                
                for (Header header:headers){
                        System.out.println("name : " +  header.getName());
                }
                
                
        }
 
}

And interceptor configuration for  Spring 

        <bean id="testInterceptor" class="com.***.springtest.TestInterceptor"/>
 
    <!-- We are adding the interceptors to the bus as we will have only one
endpoint/service/bus. -->
 
    <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
        <property name="inInterceptors">
            <ref bean="testInterceptor"/>
        </property>
        <property name="outInterceptors">
            <ref bean="testInterceptor"/>
        </property>
    </bean>



-- 
View this message in context: 
http://cxf.547215.n5.nabble.com/CXF-Interceptor-Header-tp2846750p2846750.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to