It is possible but the way it works is very different from the typical tool wrapping. One would need to modify the original web interface so that it knows where to return the results. It works like this:
- A special tool needs to be installed that will redirect to a remote URL. When the user clicks this tool in Galaxy they are redirected to the web tool and behind the scenes a new (empty) data is created in the user's history that indicates that the tool is "runnning"
- the web tool (I will refer to it as server) will need to recognize a parameter called GALAXY_URL that is sent over by Galaxy via the request in step 1. This URL contains the location of the originating request plus a encrypted string that uniquely identifies the data that was generated. The server needs to associate this parameter with the current user and remember this url for the duration of the current user's session.
- the user browses the server's resources as they desire, this may be a multipage process
- at the moment when a file would be generated by the server then instead of producing it in the browser the server will need to perform a POST operation to Galaxy using that url that was stored in step 2. In addition the server needs to redirect to Galaxy. This is the moment when the data is actually deposited into Galaxy. Upon the post process more paramters can be sent to set some of the metadata associated with the history item.
A sounds a bit complicated but it takes all that. I actually came up with this protocol and implemented this way back many-many years ago, in 2006 most likely, the first source that this worked for was the BioMart. From a cursory examination it seems that this still works this way but I cannot guarantee it since I have not been involved with it for a number of years. See this for more details:
These got me started. Once you're familiar with the basics, just dive into the Galaxy files. In the base Galaxy folder, there's a file called "tool_conf.xml" Open that up and you can find paths to tool wrappers. Then you can examine the wrapper of a tool that interests you.
Basically, simple tools can be wrapped with just an XML file. If you need something more sophisticated, you call a script (usually written in python) and pass parameters to it from your XML wrapper. That script constructs the command line for the tool and then executes it. I haven't seen this approach documented, but it's easy enough to figure out if you know a scripting language and take a few minutes to investigate. These secondary scripts are used with Picard and the tuxedo suite, among other tools.
Let me know if you need more info. I've written a ton of wrappers in Galaxy.