Results 1 to 3 of 3

Thread: Spring WS endpoint transaction AOP

  1. #1
    Join Date
    Oct 2008
    Location
    Amsterdam
    Posts
    14

    Default Spring WS endpoint transaction AOP

    Hi,

    I've created a web-service based on the holiday example.
    My endpoint classes call a number of manager classes.

    I want to surround the endpoint classes (using AOP) with a transaction so that all manager db actions are atomic.

    I searched a lot but have not yet found the answer, please advice!

    Les

  2. #2
    Join Date
    May 2009
    Posts
    4

    Default

    Hi,

    Well I wouldn't do this on the endpoint part. The transaction management with AOP should be implemented on the DAO Layer.

    Your architecture should look something like this:

    * Endpoints --> Web-Service implementations --> DAO Layer

    For example:

    Code:
    <!--  ========================= ASPECT CONFIGURATION ======================== 
      --> 
    - <!-- 		Transaction advice definition, based on method name patterns.
    		Defaults to PROPAGATION_REQUIRED with read-only hint for all methods whose name starts with
    		"start", and to PROPAGATION_REQUIRED for all other methods.
    	
      --> 
    - <tx:advice id="txAdvice" transaction-manager="txManager">
    - <tx:attributes>
      <tx:method name="start*" read-only="true" /> 
      <tx:method name="*" /> 
      </tx:attributes>
      </tx:advice>
    - <aop:config>
    - <!-- 			This definition creates auto-proxy infrastructure based on the given pointcut,
    			expressed in AspectJ pointcut language. Here: applying the advice named
    			"txAdvice" to all methods on classes extended by interfaces defined in at.ontec.econtrol.service.
    		
      --> 
      <aop:advisor pointcut="execution(* com.service.*.*(..))" advice-ref="txAdvice" /> 
    
    <!--  TransactionManager for JDBC DataSource 
      --> 
    - <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
      <property name="dataSource" ref="dataSource" /> 
      </bean>
    There you have advisor, advise and transaction manager. That is everything what you need. Look at examples of spring-ws.

    Regards,

    Music

    Quote Originally Posted by Leslie Noth View Post

    I want to surround the endpoint classes (using AOP) with a transaction so that all manager db actions are atomic.

    Les

  3. #3
    Join Date
    Oct 2008
    Location
    Amsterdam
    Posts
    14

    Default

    Hi there,
    The transaction management with AOP should be implemented on the DAO Layer.
    You mean on the service layer, that's also what the example code does.

    But I get the general idea: I will make a service class and surround that instead of the endpoint.

    "Almost any programming problem can be solved with enough levels of indirection"

    Thanx,
    Les
    Last edited by Leslie Noth; Oct 7th, 2009 at 09:09 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •