Discussion:
[Wt-interest] HTTP question
Mario Diethelm Guallar
2015-08-05 23:15:40 UTC
Permalink
Hi,

I am working on the integration of a Wt application (running on an IIS
server under Windows) with a third party local payment system. This
payment system uses two CGI modules to first start and then return
payment transaction results. In a nutshell it works as follows:

- you have to call the first CGI module (start_transaction.cgi) from a
dynamic Web page using an HTTP POST method with some parameters that you
would normally get from the user (transaction amount, user account id
and stuff like that)
- the local payment system validates and processes the request and then
a second CGI module (end_transaction.cgi), informs back transaction
results. To do that, this second CGI module expects a dynamic Web page
(.ASP, .PHP or other similar) that is invoked by the end_transaction.cgi
module and where you can access transaction payment results and complete
the transaction with the corresponding answer acknowledge

I am planning to use Wt:Http::Cient and Wt::Http::Message classes to
implement this application protocol and I would like to validate some of
my assumptions:

- to activate the first CGI module, I am planning to use the
Wt::Http::Client post(url, message) function, where url is the web
address of start_transaction.cgi and message is a Wt::Http::Message
object with all the requested parameters loaded as "headers" (name,
value pairs).
- to process the results, I am planning to build a little ASP script
(the one that will be used by end_transaction.cgi) that would recover
all the information from the answer and would send it back to the Wt
application using an HTTP POST method

Does it make sense to you? As far as I understand the Wt::Http::Client
post is an asynchronous method so I am a little bit confused about how
to be sure if the first CGI module actually runs and what Http::Client
method do I have to use to get the answer from the ASP script processing
the second CGI module response. Is it possible, as an alternative answer
processing method, to inform the Wt running application as the dynamic
Web page expected by end_transaction.cgi? If this is feasible, what
object and method do you have to use to wait for this answer?

I would appreciate your comments.


Thanks. Regards.


________________________
Mario Diethelm Guallar
Wim Dumon
2015-08-10 10:25:43 UTC
Permalink
Hello Mario,

To process the result, you can as well use a WResource from Wt instead of
the ASP script.

To know when the request was finished and to act on the response of a
request, connect a method to the 'done()' signal of the client. See also
the code example in Http::Client.

Best regards,
Wim.
Post by Mario Diethelm Guallar
Hi,
I am working on the integration of a Wt application (running on an IIS
server under Windows) with a third party local payment system. This payment
system uses two CGI modules to first start and then return payment
- you have to call the first CGI module (start_transaction.cgi) from a
dynamic Web page using an HTTP POST method with some parameters that you
would normally get from the user (transaction amount, user account id and
stuff like that)
- the local payment system validates and processes the request and then a
second CGI module (end_transaction.cgi), informs back transaction results.
To do that, this second CGI module expects a dynamic Web page (.ASP, .PHP
or other similar) that is invoked by the end_transaction.cgi module and
where you can access transaction payment results and complete the
transaction with the corresponding answer acknowledge
I am planning to use Wt:Http::Cient and Wt::Http::Message classes to
implement this application protocol and I would like to validate some of my
- to activate the first CGI module, I am planning to use the
Wt::Http::Client post(url, message) function, where url is the web address
of start_transaction.cgi and message is a Wt::Http::Message object with all
the requested parameters loaded as "headers" (name, value pairs).
- to process the results, I am planning to build a little ASP script (the
one that will be used by end_transaction.cgi) that would recover all the
information from the answer and would send it back to the Wt application
using an HTTP POST method
Does it make sense to you? As far as I understand the Wt::Http::Client
post is an asynchronous method so I am a little bit confused about how to
be sure if the first CGI module actually runs and what Http::Client method
do I have to use to get the answer from the ASP script processing the
second CGI module response. Is it possible, as an alternative answer
processing method, to inform the Wt running application as the dynamic Web
page expected by end_transaction.cgi? If this is feasible, what object and
method do you have to use to wait for this answer?
I would appreciate your comments.
Thanks. Regards.
________________________
*Mario Diethelm Guallar*
------------------------------------------------------------------------------
_______________________________________________
witty-interest mailing list
https://lists.sourceforge.net/lists/listinfo/witty-interest
Mario Diethelm Guallar
2015-08-10 17:59:47 UTC
Permalink
Thank you Wim. I will work following your recommendations.

As far as I understand, to use a WResource I should notify the third
party CGI module (end_transaction) the suggestedFileName that I decide
to assign to the WResource object (equivalent to the ASP script file
name) and implement the handleRequest function to manage the
request/response logic. What kind of DispossiontType should I use for
the WResource (Inline or Attachment) ?

Regarding the done() signal, if I am not misunderstanding your
suggestion and the Http::Client example, the Wt library will trigger the
done() signal when the running WServer receives the third party answer.
Is that correct?

Thanks again. Regards.

________________________
Mario Diethelm Guallar



------ Original Message ------
From: "Wim Dumon" <***@emweb.be>
To: "Mario Diethelm Guallar" <***@gmail.com>;
witty-***@lists.sourceforge.net
Sent: 10-08-2015 07:25:43
Subject: Re: [Wt-interest] HTTP question
Post by Wim Dumon
Hello Mario,
To process the result, you can as well use a WResource from Wt instead
of the ASP script.
To know when the request was finished and to act on the response of a
request, connect a method to the 'done()' signal of the client. See
also the code example in Http::Client.
Best regards,
Wim.
On 6 August 2015 at 01:15, Mario Diethelm Guallar
Post by Mario Diethelm Guallar
Hi,
I am working on the integration of a Wt application (running on an IIS
server under Windows) with a third party local payment system. This
payment system uses two CGI modules to first start and then return
- you have to call the first CGI module (start_transaction.cgi) from a
dynamic Web page using an HTTP POST method with some parameters that
you would normally get from the user (transaction amount, user account
id and stuff like that)
- the local payment system validates and processes the request and
then a second CGI module (end_transaction.cgi), informs back
transaction results. To do that, this second CGI module expects a
dynamic Web page (.ASP, .PHP or other similar) that is invoked by the
end_transaction.cgi module and where you can access transaction
payment results and complete the transaction with the corresponding
answer acknowledge
I am planning to use Wt:Http::Cient and Wt::Http::Message classes to
implement this application protocol and I would like to validate some
- to activate the first CGI module, I am planning to use the
Wt::Http::Client post(url, message) function, where url is the web
address of start_transaction.cgi and message is a Wt::Http::Message
object with all the requested parameters loaded as "headers" (name,
value pairs).
- to process the results, I am planning to build a little ASP script
(the one that will be used by end_transaction.cgi) that would recover
all the information from the answer and would send it back to the Wt
application using an HTTP POST method
Does it make sense to you? As far as I understand the Wt::Http::Client
post is an asynchronous method so I am a little bit confused about how
to be sure if the first CGI module actually runs and what Http::Client
method do I have to use to get the answer from the ASP script
processing the second CGI module response. Is it possible, as an
alternative answer processing method, to inform the Wt running
application as the dynamic Web page expected by end_transaction.cgi?
If this is feasible, what object and method do you have to use to wait
for this answer?
I would appreciate your comments.
Thanks. Regards.
________________________
Mario Diethelm Guallar
------------------------------------------------------------------------------
_______________________________________________
witty-interest mailing list
https://lists.sourceforge.net/lists/listinfo/witty-interest
Koen Deforche
2015-08-11 09:12:59 UTC
Permalink
Hey Mario,

It's still not entirely clear to me what the payment system expects.

We have experience with two different types of systems:
- systems that require the user's browser to be redirect to a payment
site where the user will have to confirm the transaction (sometimes
being redirect further to their online bank system for 3D
verification). E.g. this is how Paypal typically works.
- systems where you capture all the relevant information inside your
own web application, and you deal with the 3rd party payment system
purely using web services. The user does not leave your application.

In the first case, there are different variants, but typically it
involves use of static or dynamic WResource's to handle the redirect
from the third party system back to the wt application. This approach
is a bit more complicated with a Wt application because it's a
single-page application.

In the second case, it's quite simpler. You only need to a use a HTTP
client to interact with the 3rd party web services. As wim said, the
http client is asynchronous, but you can follow the pattern as
explained in the Http::Client documentation with deferRendering() and
resumeRendering() to fix easily integrate it in a Wt application. This
approach works okay as long as you expect the web services to respond
quickly. Otherwise it's better to user server push instead of
deferRendering() to not block your UI while you are waiting for the
web service to respond.

Regards,
koen
Post by Mario Diethelm Guallar
Thank you Wim. I will work following your recommendations.
As far as I understand, to use a WResource I should notify the third party
CGI module (end_transaction) the suggestedFileName that I decide to assign
to the WResource object (equivalent to the ASP script file name) and
implement the handleRequest function to manage the request/response logic.
What kind of DispossiontType should I use for the WResource (Inline or
Attachment) ?
Regarding the done() signal, if I am not misunderstanding your suggestion
and the Http::Client example, the Wt library will trigger the done() signal
when the running WServer receives the third party answer. Is that correct?
Thanks again. Regards.
________________________
Mario Diethelm Guallar
------ Original Message ------
Sent: 10-08-2015 07:25:43
Subject: Re: [Wt-interest] HTTP question
Hello Mario,
To process the result, you can as well use a WResource from Wt instead of
the ASP script.
To know when the request was finished and to act on the response of a
request, connect a method to the 'done()' signal of the client. See also the
code example in Http::Client.
Best regards,
Wim.
Post by Mario Diethelm Guallar
Hi,
I am working on the integration of a Wt application (running on an IIS
server under Windows) with a third party local payment system. This payment
system uses two CGI modules to first start and then return payment
- you have to call the first CGI module (start_transaction.cgi) from a
dynamic Web page using an HTTP POST method with some parameters that you
would normally get from the user (transaction amount, user account id and
stuff like that)
- the local payment system validates and processes the request and then a
second CGI module (end_transaction.cgi), informs back transaction results.
To do that, this second CGI module expects a dynamic Web page (.ASP, .PHP or
other similar) that is invoked by the end_transaction.cgi module and where
you can access transaction payment results and complete the transaction with
the corresponding answer acknowledge
I am planning to use Wt:Http::Cient and Wt::Http::Message classes to
implement this application protocol and I would like to validate some of my
- to activate the first CGI module, I am planning to use the
Wt::Http::Client post(url, message) function, where url is the web address
of start_transaction.cgi and message is a Wt::Http::Message object with all
the requested parameters loaded as "headers" (name, value pairs).
- to process the results, I am planning to build a little ASP script (the
one that will be used by end_transaction.cgi) that would recover all the
information from the answer and would send it back to the Wt application
using an HTTP POST method
Does it make sense to you? As far as I understand the Wt::Http::Client
post is an asynchronous method so I am a little bit confused about how to be
sure if the first CGI module actually runs and what Http::Client method do I
have to use to get the answer from the ASP script processing the second CGI
module response. Is it possible, as an alternative answer processing method,
to inform the Wt running application as the dynamic Web page expected by
end_transaction.cgi? If this is feasible, what object and method do you have
to use to wait for this answer?
I would appreciate your comments.
Thanks. Regards.
________________________
Mario Diethelm Guallar
------------------------------------------------------------------------------
_______________________________________________
witty-interest mailing list
https://lists.sourceforge.net/lists/listinfo/witty-interest
------------------------------------------------------------------------------
_______________________________________________
witty-interest mailing list
https://lists.sourceforge.net/lists/listinfo/witty-interest
------------------------------------------------------------------------------
Mario Diethelm Guallar
2015-08-11 12:00:04 UTC
Permalink
Thank you Koen. I really appreciate your comments and Wim's suggestions.

In this case the payment system that we are talking about, works
following the first model that you described, i.e. it takes control over
the process flow and redirects the user's browser to the payment system
site where a standard payment interface (web pages) is used to capture
specific payment transaction data (credit/debit card number, user id and
others). As you commented, eventually the user browser is redirected to
the user's online bank system for further verifications and then goes
back to the payment system.

In that scenario and following Wim's recommendations and your own
recommendations, I will work implementing the corresponding WResource
specializations to deal with each step of the payment flow.

Regards. Thanks again.
________________________
Mario Diethelm Guallar


------ Original Message ------
From: "Koen Deforche" <***@emweb.be>
To: "Mario Diethelm Guallar" <***@gmail.com>;
"witty-***@lists.sourceforge.net"
<witty-***@lists.sourceforge.net>
Cc: "Wim Dumon" <***@emweb.be>
Sent: 11-08-2015 06:12:59
Subject: Re: [Wt-interest] HTTP question
Post by Koen Deforche
Hey Mario,
It's still not entirely clear to me what the payment system expects.
- systems that require the user's browser to be redirect to a payment
site where the user will have to confirm the transaction (sometimes
being redirect further to their online bank system for 3D
verification). E.g. this is how Paypal typically works.
- systems where you capture all the relevant information inside your
own web application, and you deal with the 3rd party payment system
purely using web services. The user does not leave your application.
In the first case, there are different variants, but typically it
involves use of static or dynamic WResource's to handle the redirect
from the third party system back to the wt application. This approach
is a bit more complicated with a Wt application because it's a
single-page application.
In the second case, it's quite simpler. You only need to a use a HTTP
client to interact with the 3rd party web services. As wim said, the
http client is asynchronous, but you can follow the pattern as
explained in the Http::Client documentation with deferRendering() and
resumeRendering() to fix easily integrate it in a Wt application. This
approach works okay as long as you expect the web services to respond
quickly. Otherwise it's better to user server push instead of
deferRendering() to not block your UI while you are waiting for the
web service to respond.
Regards,
koen
2015-08-10 19:59 GMT+02:00 Mario Diethelm Guallar
Post by Mario Diethelm Guallar
Thank you Wim. I will work following your recommendations.
As far as I understand, to use a WResource I should notify the third
party
CGI module (end_transaction) the suggestedFileName that I decide to
assign
to the WResource object (equivalent to the ASP script file name) and
implement the handleRequest function to manage the request/response
logic.
What kind of DispossiontType should I use for the WResource (Inline
or
Attachment) ?
Regarding the done() signal, if I am not misunderstanding your
suggestion
and the Http::Client example, the Wt library will trigger the done()
signal
when the running WServer receives the third party answer. Is that
correct?
Thanks again. Regards.
________________________
Mario Diethelm Guallar
------ Original Message ------
Sent: 10-08-2015 07:25:43
Subject: Re: [Wt-interest] HTTP question
Hello Mario,
To process the result, you can as well use a WResource from Wt
instead of
the ASP script.
To know when the request was finished and to act on the response of a
request, connect a method to the 'done()' signal of the client. See
also the
code example in Http::Client.
Best regards,
Wim.
On 6 August 2015 at 01:15, Mario Diethelm Guallar
Post by Mario Diethelm Guallar
Hi,
I am working on the integration of a Wt application (running on an
IIS
server under Windows) with a third party local payment system. This
payment
system uses two CGI modules to first start and then return payment
- you have to call the first CGI module (start_transaction.cgi) from
a
dynamic Web page using an HTTP POST method with some parameters that
you
would normally get from the user (transaction amount, user account
id and
stuff like that)
- the local payment system validates and processes the request and
then a
second CGI module (end_transaction.cgi), informs back transaction
results.
To do that, this second CGI module expects a dynamic Web page (.ASP,
.PHP or
other similar) that is invoked by the end_transaction.cgi module and
where
you can access transaction payment results and complete the
transaction with
the corresponding answer acknowledge
I am planning to use Wt:Http::Cient and Wt::Http::Message classes to
implement this application protocol and I would like to validate
some of my
- to activate the first CGI module, I am planning to use the
Wt::Http::Client post(url, message) function, where url is the web
address
of start_transaction.cgi and message is a Wt::Http::Message object
with all
the requested parameters loaded as "headers" (name, value pairs).
- to process the results, I am planning to build a little ASP script
(the
one that will be used by end_transaction.cgi) that would recover all
the
information from the answer and would send it back to the Wt
application
using an HTTP POST method
Does it make sense to you? As far as I understand the
Wt::Http::Client
post is an asynchronous method so I am a little bit confused about
how to be
sure if the first CGI module actually runs and what Http::Client
method do I
have to use to get the answer from the ASP script processing the
second CGI
module response. Is it possible, as an alternative answer processing
method,
to inform the Wt running application as the dynamic Web page
expected by
end_transaction.cgi? If this is feasible, what object and method do
you have
to use to wait for this answer?
I would appreciate your comments.
Thanks. Regards.
________________________
Mario Diethelm Guallar
------------------------------------------------------------------------------
_______________________________________________
witty-interest mailing list
https://lists.sourceforge.net/lists/listinfo/witty-interest
------------------------------------------------------------------------------
_______________________________________________
witty-interest mailing list
https://lists.sourceforge.net/lists/listinfo/witty-interest
------------------------------------------------------------------------------
Mario Diethelm Guallar
2015-08-29 20:04:21 UTC
Permalink
Hi guys,

I have been working over the integration with this local payment system
and even though I have succeeded connecting to the payment system and
starting the payment transaction, I got stuck where the payment system
takes the transaction control. I have followed in deep detail the PayPal
example included with Wt and in fact the transaction flow is pretty
similar:

- the payment system is started through an Http POST call to a CGI
module using some parameters to identify the transaction that you are
planning to execute (transaction type, amount, a transaction unique
identifier)
- The POST message is executed without problems. The done() signal
triggers a method that checks for the response code and error code. No
errors and an Http response code 200 is received
- Besides that, the CGI module that is invoked with the POST call,
records a log file where I can verify that everything is going ok
- The last action that is executed by the CGI module after validating
the input and doing some preparation working is to redirect the web
session to a payment system handled page, where the user selects the
payment method (credit card o debit card) and enters some data (card
number and others). As far as I understand, in the case of PayPal
connector is the Wt application itself who redirects the web page to a
new URL
- In the case of the local payment system, when the CGI module tries to
execute the web page redirection I am not sure how to proceed. In have
tried different alternatives (WAnchor opening a new page using a
TargetNewWindow, clearing the current container and others) but I have
never been able to get the page where it is supposed the user should be
redirected

I am absolutely clear that you would need a much more detailed
description to fully understand what is going on, but at this time I
would ask for some general advice:

- Is it possible for a Wt application to pass the program control flow
to an external system and then, in some way, return to the state where
the application was at the moment that lost the program control flow (I
guess the answer is yes because the PayPal example does something like
this but then the question is what are the conditions that the Wt
application should fulfill?
- in this particular case, where the external application redirects the
user browser to a new page, how the Wt application should prepare the
scenario in order to allow the user to surf through the payment system
and then go back to the Wt application?

I would appreciate your comments on this matter.

Regards.
________________________
Mario Diethelm Guallar

------ Original Message ------
From: "Koen Deforche" <***@emweb.be>
To: "Mario Diethelm Guallar" <***@gmail.com>;
"witty-***@lists.sourceforge.net"
<witty-***@lists.sourceforge.net>
Cc: "Wim Dumon" <***@emweb.be>
Sent: 11-08-2015 06:12:59
Subject: Re: [Wt-interest] HTTP question
Post by Koen Deforche
Hey Mario,
It's still not entirely clear to me what the payment system expects.
- systems that require the user's browser to be redirect to a payment
site where the user will have to confirm the transaction (sometimes
being redirect further to their online bank system for 3D
verification). E.g. this is how Paypal typically works.
- systems where you capture all the relevant information inside your
own web application, and you deal with the 3rd party payment system
purely using web services. The user does not leave your application.
In the first case, there are different variants, but typically it
involves use of static or dynamic WResource's to handle the redirect
from the third party system back to the wt application. This approach
is a bit more complicated with a Wt application because it's a
single-page application.
In the second case, it's quite simpler. You only need to a use a HTTP
client to interact with the 3rd party web services. As wim said, the
http client is asynchronous, but you can follow the pattern as
explained in the Http::Client documentation with deferRendering() and
resumeRendering() to fix easily integrate it in a Wt application. This
approach works okay as long as you expect the web services to respond
quickly. Otherwise it's better to user server push instead of
deferRendering() to not block your UI while you are waiting for the
web service to respond.
Regards,
koen
2015-08-10 19:59 GMT+02:00 Mario Diethelm Guallar
Post by Mario Diethelm Guallar
Thank you Wim. I will work following your recommendations.
As far as I understand, to use a WResource I should notify the third
party
CGI module (end_transaction) the suggestedFileName that I decide to
assign
to the WResource object (equivalent to the ASP script file name) and
implement the handleRequest function to manage the request/response
logic.
What kind of DispossiontType should I use for the WResource (Inline
or
Attachment) ?
Regarding the done() signal, if I am not misunderstanding your
suggestion
and the Http::Client example, the Wt library will trigger the done()
signal
when the running WServer receives the third party answer. Is that
correct?
Thanks again. Regards.
________________________
Mario Diethelm Guallar
------ Original Message ------
Sent: 10-08-2015 07:25:43
Subject: Re: [Wt-interest] HTTP question
Hello Mario,
To process the result, you can as well use a WResource from Wt
instead of
the ASP script.
To know when the request was finished and to act on the response of a
request, connect a method to the 'done()' signal of the client. See
also the
code example in Http::Client.
Best regards,
Wim.
On 6 August 2015 at 01:15, Mario Diethelm Guallar
Post by Mario Diethelm Guallar
Hi,
I am working on the integration of a Wt application (running on an
IIS
server under Windows) with a third party local payment system. This
payment
system uses two CGI modules to first start and then return payment
- you have to call the first CGI module (start_transaction.cgi) from
a
dynamic Web page using an HTTP POST method with some parameters that
you
would normally get from the user (transaction amount, user account
id and
stuff like that)
- the local payment system validates and processes the request and
then a
second CGI module (end_transaction.cgi), informs back transaction
results.
To do that, this second CGI module expects a dynamic Web page (.ASP,
.PHP or
other similar) that is invoked by the end_transaction.cgi module and
where
you can access transaction payment results and complete the
transaction with
the corresponding answer acknowledge
I am planning to use Wt:Http::Cient and Wt::Http::Message classes to
implement this application protocol and I would like to validate
some of my
- to activate the first CGI module, I am planning to use the
Wt::Http::Client post(url, message) function, where url is the web
address
of start_transaction.cgi and message is a Wt::Http::Message object
with all
the requested parameters loaded as "headers" (name, value pairs).
- to process the results, I am planning to build a little ASP script
(the
one that will be used by end_transaction.cgi) that would recover all
the
information from the answer and would send it back to the Wt
application
using an HTTP POST method
Does it make sense to you? As far as I understand the
Wt::Http::Client
post is an asynchronous method so I am a little bit confused about
how to be
sure if the first CGI module actually runs and what Http::Client
method do I
have to use to get the answer from the ASP script processing the
second CGI
module response. Is it possible, as an alternative answer processing
method,
to inform the Wt running application as the dynamic Web page
expected by
end_transaction.cgi? If this is feasible, what object and method do
you have
to use to wait for this answer?
I would appreciate your comments.
Thanks. Regards.
________________________
Mario Diethelm Guallar
------------------------------------------------------------------------------
_______________________________________________
witty-interest mailing list
https://lists.sourceforge.net/lists/listinfo/witty-interest
------------------------------------------------------------------------------
_______________________________________________
witty-interest mailing list
https://lists.sourceforge.net/lists/listinfo/witty-interest
------------------------------------------------------------------------------
Loading...