tags:

views:

57

answers:

5

Trying to figure out a way where I can pass some data/fields from a web page back into my application. This needs to works on Windows/Linux/Mac so I can't use a DLL or ActiveX. Any ideas?

Here's the flow: 1. Application gathers some data and then sends it to a web page using POST that is either imbedded in the app or pops up a new IE window. 2. The web page does some services and then needs to relay the results back to the application.

The only way to do this that I can think of is writing the results locally from the page in a cookie or something like that and have the application monitor for a specific file in that folder.

Alternatively, make a web service that the application hits after passing control to the page and when the page is done the web service will return the data. This sounds like it might have some performance drawbacks.

Can anyone suggest any better solutions for this?

Thanks

+2  A: 

My suggestion:

Break the processing logic out of the Web Page into a seperate assembly. You can then create a Web Service that handles all of the processing without needing to pass control over to a page.

Your application can then call the Web Service directly and then serialize the results and work with the data quite easily.

Update

Since the page is supplied by a third party, you obviously can't break anything out. The next best thing would be to handle the entire web request internal to your application (rather than popping a new Window).

With this method, you can get the raw HTTP response (and page markup) and work with it directly. You can then parse the Response stream and gather the required data from it.

Justin Niessner
Problem is that the web page is hosted by a third party and they need to be doing the processing on their servers. I can't do the processing of that data locally.
markiyanm
Justin - I like your approach better :)
Sijin
The issue is that the data being processed is credit card info which I'm trying to offload to the third party since that's what they do and I want to stay out of it. I currently support it by using a web service but that keeps me in scope for credit card regulations. If I use their page I get to avoid that.
markiyanm
@markiyanm - My Updated suggestion still uses the third-party website which should offload everything. You just have to parse through the page results to get your data out of it.
Justin Niessner
Thanks for your help Justin
markiyanm
A: 

During performing an HTTP request you should be able to retrieve the text returned by the page. For instance, if your HTTP POST was to hit a Java servlet, the doPost() method would be fired and you would then perform your actions, you could then use the PrintWriter object from the Response object (PrintWriter out = response.getWriter();) and write text back to the calling application. I'm not sure this helps?

Xandel
A: 

The fact that

web page is hosted by a third party and they need to be doing the processing on their servers.

is important to this question.

I like your idea of having the app call a webservice after it passes the data to the third-paty web page. You can always call the webservice asynchronously if you're worried about blocking your application while waiting for results from this webservice.

Sijin
A: 

Another option is that your application implements an XML-RPC server that can be called from the web page using PHP, Python or whatever you use to build the website

A REST server will do the job also...

maid450
A: 

Perhaps the iOpus product iMacros might be what you are looking for. Their product iMacros is pretty good at collecting data and posting data. I have used it for conditional data mining and there are plenty of examples available for a variety of tasks.

I will admit that there is a bit of a learning curve but it is really quite powerful in how it interacts with URL's, forms, and other software.

You can look at some examples and see if it meets your needs here: http://www.iopus.com/imacros/support/

There is also a free firefox add-on here: http://www.iopus.com/imacros/firefox/

BornReady