This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am posting a transaction to a vendor (Action-1). After posting, Action-1 returns null. If Action-1 posting is successful, the vendor posts back a transaction number to a second action (Action-2). I want Action-2 to confirm the successful transaction and forward the user to a "home page".
I can confirm that Action-1 successfully POSTs to the vendor, that the vendor's POST back contains the transaction number and that Action-2 can read it i.e. the "xid" parameter in action-2 is not null.
However, instead of being forwarded to the "home page" from Action-2, execution comes back to action-1 at the "return null;" line and I get a blank screen.
It seems to me that in Action-1 you will need to send the post to the external vendor and then some how wait for the response. My first though would be to set up a loop that polled the database (or some other external resource) looking for a status. When Action-2 is called it would update the database record with the success status. A similar option (and something that is common for long running queries) would be to have Action-1 forward to a "your request is processing" page and have that page refresh every few seconds and check the processing status. If processing is complete then forward to the "success" page.
Is there anyway to have the vendor return the status on your request or for you to switch over to more of a web services interface?
Joined: Apr 18, 2006
All very good suggestions. I'll let y'all know how this turns out.