middleware, sort of (same question, different posting software)

T

Tigerhillside

I forgot I had a "real" newsreader available. So here is the
question you will see "soon" when google decides to post my other
question.


I have a server side script that takes a user's input in a form,
packages it, and sends it on to an external server. The external
server will then send back the response via http to my server
script. But not the same script. And there is the rub, I don't
know how the second script can get to my user.

Let me diagram this for clarity.

The logic is this:

Client -> me -> XS (external server) -> me -> client

Simple enough.

But as I see it, programmatically it goes like this:

browser -> me script1 -> XS

XS -> script2 -> browser

I can't open a pipe to the external server, I only have http
access. So I can't get the response back in the same script
AFAICT. My script1 and script2 know enough to know it is the same
transaction, but script2 can't find the browser/script1
conversation.

I suppose I could have script1 wait around until script2 writes a
token of some sort saying it got the results. That seems like a
hack, but if that is how it is done I can do that. Wait something
like 30 seconds, checking every second for the token. Is that how
it is done or is there a better way? Something like a named pipe
or something that script2 can get its hands on?

I know this is not, strictly speaking, a perl language question,
but it is on topic.


Thanks very much in advance.
 
T

Tigerhillside

In comp.lang.perl, Tigerhillside
I forgot I had a "real" newsreader available. So here is the
question you will see "soon" when google decides to post my other
question.


I have a server side script that takes a user's input in a form,
packages it, and sends it on to an external server. The external
server will then send back the response via http to my server
script. But not the same script. And there is the rub, I don't
know how the second script can get to my user.

Let me diagram this for clarity.

The logic is this:

Client -> me -> XS (external server) -> me -> client

Simple enough.

But as I see it, programmatically it goes like this:

browser -> me script1 -> XS

XS -> script2 -> browser

I can't open a pipe to the external server, I only have http
access. So I can't get the response back in the same script
AFAICT. My script1 and script2 know enough to know it is the same
transaction, but script2 can't find the browser/script1
conversation.

I suppose I could have script1 wait around until script2 writes a
token of some sort saying it got the results. That seems like a
hack, but if that is how it is done I can do that. Wait something
like 30 seconds, checking every second for the token. Is that how
it is done or is there a better way? Something like a named pipe
or something that script2 can get its hands on?

I know this is not, strictly speaking, a perl language question,
but it is on topic.


Thanks very much in advance.

Ok, I won't say I'm an idiot. After all, there are few bette ways
to solve a problem on your own than to ask someone for help. My
problem was that I misunderstood some documentation. (So much for
RTFM as a silver bullet.) There are two ways to do what I needed
from the external server. I could send my user to their web page,
in which case the response came back to one of my server pages.
Or I could just send the information, in which case I get a
response. But I thought that the only way I got my response was
via the other web page. Since I can get the response from the
calling script I can just use the LWP module and everything will
be fine. Thanks for being there anyway.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top