I am creating a
Java web service that is receiving input requests in XML format. The web service's function is to parse the XML initial request and send it's own post request to a third party organization which does a look-up for the request and if available they send a response back in XML format to the web service for processing. If the response does find the data in the look-up the information it sends back as XML and is parsed by the web service then saved as a .pdf file. Once the .pdf file is created the web service packages a response XML message and along with the identifying information a link to the .pdf is part of the message sent back to the calling client. Now, if the search for the information is not found a XML message is sent back to the client indication the third party did not have the information ready with a status as pending. For all of the requests for the third party information the web service will create a folder on the server with a XML status file and if the .pdf file is created it will be in this folder too.
Now comes the tricky part of the design. There is another application located on the same server that needs to be running in a loop that and every 30 second it needs to call the web service on it's own and if the server folder created by each new request does not contain the .pdf that program will make the web service call to retry the initial call and see if third party does now responds with the XML message that contains the valid information so it can create the .pdf and send a message back to the original client.
Now, if I am using a
tomcat server what type of application should I create that does the 30 second looping? The server does have a MySQL database. How should I have the 30 second looping application communicate with the web service? Finally, if the looping application does make a successful call to the web service what is the best way to cause a trigger from the looping application to make the web service send the successful response to the original calling client?
Finally, if the looping application does make a successful call to the web service what is the best way to cause a trigger from the looping application to make the web service send the successful response to the original calling client? One note is that the 30 second loop must scan the new request folder tree and retry for any of the requests that have not succeeded.