Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: flowExecutionKey difficulties

  1. #1
    Join Date
    Sep 2005
    Posts
    18

    Default flowExecutionKey difficulties

    I have a problem with calling an external service. My application is a simple booking system. At one point in the flow I have to call an external service that handles payment. The payment service exposes a web service that I use to set up the transaction. One of the parameters to this web service is the page that I want it to redirect the user back to, and the return value is the url that I have to redirect the user to to start payment. There are also some other data that I am passing in the web service call (user information, amount, currency etc.)

    The problem is that I don't know what url to send to the payment service for the 'redirect back to' field. I tried jumping to the payment service like this:

    Code:
    	<view-state id="processPayment" view="externalRedirect:${flowScope.redirect}" >
    		<entry-actions>
    			<action bean="paymentAction" method="pay"/>
    		</entry-actions>
    		<transition on="success" to="finish"/>
    	</view-state>
    .. but I lose the correct flowExecutionKey. It's sent along as an url parameter by externalRedirect, but that's no use to me. The flowExecutionKey that's current in the paymentAction.pay call is not correct for the redirect back to the flow.

    Any ideas?

    -Magnus

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    Why is it not correct? If it's sent via the external redirect you should be able to take that key and use it to redirect back to the flow execution to continue with a "success" event from your "processPayment" view state.
    Keith Donald
    Core Spring Development Team

  3. #3
    Join Date
    Sep 2005
    Posts
    18

    Default

    The one that is included in the redirected url is correct, but I don't have control of the external service, so I'm unable to pick it up. The one that is active when my entry-action is run (which is where I set up the 'callback') seems to be the flowExecutionKey for the previous state.

    -Magnus

  4. #4
    Join Date
    Sep 2005
    Posts
    18

    Default

    Any ideas for how I can get around this? It's a showstopper for our project.

    -Magnus

  5. #5
    portlet2 Guest

    Default

    do some debugging mate,

    for a while put the external service to a page written by you. check whether you get _flowExecutionKey and _x_eventId

    it should not be a problem as it is very straightforward.

    Is it also not possible that one of the flow methods call the webservice and you make the decision rather than going to the external page. AS you say it is a webservice.

  6. #6
    Join Date
    Sep 2005
    Posts
    18

    Default

    I think I have been unable to explain my problem. I know that the flow execution key that is appended to the url that the user is redirected to is correct. But I need that key _before_ the redirect, so that I can use it in my web service call, when I set up the callback. The external service that I'm using has this usage pattern:

    1. call a web service to set up a payment transaction. I send payment details and the 'callback url' and get a payment id and a redirection url back.

    2. redirect the user to the redirection url that I received in step 1.

    3. the payment service takes the user through a number of steps, and then redirects the user to the callback url I sent in step 1.

    4. my application makes another webservice call to confirm the payment, using the payment id that I received in step 1.

    And my problem is that the flow execution key that I need to include in my 'callback url' is not available to me before the redirection is done.

    -Magnus

  7. #7
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    I see Magnus.

    So to confirm what you need here: you need a flow action to invoke your web service and pass it the flow execution key. You're having trouble because you don't know how to get a hold of this key from inside your flow execution.

    Right?

    Keith
    Keith Donald
    Core Spring Development Team

  8. #8
    Join Date
    Sep 2005
    Posts
    18

    Default

    I think that is correct, yes. I tried
    Code:
    String key = rc.getExternalContext().getRequestParameterMap().get("_flowExecutionKey")
    but that gets me the previous key, of course.

    -Magnus
    Last edited by Mammux; Jun 19th, 2006 at 04:17 AM.

  9. #9
    Join Date
    Jun 2006
    Posts
    2

    Default

    Hi,

    try using the SingleKeyFlowExecutionRepository flow execution factory, bean setup like
    Code:
    	<bean id="flowExecutor"
    		class="org.springframework.webflow.executor.FlowExecutorImpl">
    		<constructor-arg ref="repositoryFactory"/>
    		<property name="redirectOnPause" value="false"/>
    	</bean>
    
    	<bean id="repositoryFactory" class="org.springframework.webflow.execution.repository.support.SingleKeyFlowExecutionRepositoryFactory">
    		<constructor-arg ref="flowRegistry"/>
    	</bean>
    
    	<bean id="flowRegistry"
    		class="org.springframework.webflow.registry.XmlFlowRegistryFactoryBean">
    		<property name="flowLocations" value="/WEB-INF/flows/**/*-flow.xml"/>
    	</bean>
    (not sure about the redirectOnPause attribute though). I think this factory came with rc2.

    I got this solution working with a similar scenario as yours. I capture the flow execution key the same way as you earlier in the flow. The controller handling the feedback from the external service returns a redirect with the flow id, key and event name back to the client which is then able to resume the flow.

    -Arne

  10. #10
    Join Date
    Sep 2005
    Posts
    18

    Default

    I would do that or something similar, but I am otherwise very happy with the behaviour that the ContinuationFlowExecutionRepository gives me. I hestitate to sacrifice good back-button behaviour to get this.

    Your reply made me a bit uncertain, Keith. Is there a way to get the current flow exection key inside an action?

    -Magnus

Posting Permissions

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