Announcement Announcement Module
Collapse
No announcement yet.
Web Service Security Interceptor in SimpleWebServiceOutboundGateway Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Web Service Security Interceptor in SimpleWebServiceOutboundGateway

    Hi,

    I would like to implement message level web service security.
    To use it with spring web services, we need to define an interceptor and
    set the WebServiceTemplate.

    <beans:bean id="wss4jInterceptor"
    class="org.springframework.ws.soap.security.wss4j. Wss4jSecurityInterceptor">
    <beansroperty name="securementActions" value="UsernameToken" />
    <beansroperty name="securementUsername" value="Ernie" />
    <beansroperty name="securementPassword" value="Bert" />
    </beans:bean>

    In spring integration SimpleWebServiceOutboundGateway,
    the <ws:outbound-gateway> has no way to allow me to set this.

    Is it the only way to do this is extends the SimpleWebServiceOutboundGateway and set the interceptors to the internal WebServiceTemplate?

    Thank in advance.

    Rgds,Jimmy

  • #2
    Could you open a JIRA issue? We should simply provide a setter to pass interceptors through to the inner template instance.

    For now, you could subclass. The getWebServiceTemplate() method is accessible (protected).

    Thanks,
    Mark

    Comment


    • #3
      Mark,

      How to define a custom(subclassed) web service outbound gateway?

      Thanks

      Comment


      • #4
        You can subclass, but of course you would lose namespace support. Instead, you would configure the gateway as a <bean/>.

        Comment


        • #5
          It is not clear how to include this gateway bean into SI flow without namespace support.
          Could you please provide an example how to define bean and use it for instance in SI chain?

          Comment


          • #6
            Umm, May be I am little bit late in reply, you can do this,

            package com.hello;

            import org.springframework.beans.factory.InitializingBean ;
            import org.springframework.integration.ws.SimpleWebServic eOutboundGateway;
            import org.springframework.ws.client.support.destination. DestinationProvider;
            import org.springframework.ws.client.support.interceptor. ClientInterceptor;

            public class MyWebServiceOutboundGateway extends
            SimpleWebServiceOutboundGateway implements InitializingBean {

            ClientInterceptor[] interceptors;

            public MyWebServiceOutboundGateway(DestinationProvider destinationProvider) {
            super(destinationProvider);
            }

            @Override
            public void afterPropertiesSet() throws Exception {
            getWebServiceTemplate().setInterceptors(intercepto rs);

            }

            }


            <beans:bean id="myWSOutboundGateway" class="com.hello.MyWebServiceOutboundGateway">
            <beans:constructor-arg ref="mydestinationprovider" />
            <beansroperty name="interceptors" >
            <beans:list>
            <beans:ref bean="wss4jInterceptor"/>
            </beans:list>
            </beansroperty>
            </beans:bean>

            <beans:bean id="mydestinationprovider" class="org.springframework.integration.ws.config.F ixedUriDestinationProvider">
            <beans:constructor-arg value="http://www.hello.com/webservices" />
            </beans:bean>


            <beans:bean id="wss4jInterceptor"
            class="org.springframework.ws.soap.security.wss4j. Wss4jSecurityInterceptor">
            <beansroperty name="securementActions" value="UsernameToken" />
            <beansroperty name="securementUsername" value="Ernie" />
            <beansroperty name="securementPassword" value="Bert" />
            </beans:bean>

            Comment


            • #7
              Hi Mark,

              JIRA issued. Sorry for late reply.
              http://jira.springframework.org/browse/INT-1056

              Rgds,Jimmy

              Comment

              Working...
              X