NetTalk Central

Author Topic: NetWebClient - PageReceived to view response from server  (Read 4452 times)

rupertvz

  • Sr. Member
  • ****
  • Posts: 326
    • View Profile
    • Email
NetWebClient - PageReceived to view response from server
« on: February 28, 2012, 05:43:28 AM »
Hi Guys,

I created a new application with a generic window that posts to a URL.  

I used the following method to post

LOC:P1Value = '1234'

RequestNo = 1
thisclient.FreeFieldsQueue()
thisclient.SetValue('p1',clip(LOC:P1Value))
thisclient.ContentType='application/x-www-form-urlencoded'

ThisClient.Post('URL','')

I am unable to see any response.  I used PageReceived embed and tried:
LOC:ReturnValue = ThisClient.Page
LOC:ReturnValue = ThisClient.PageLen

* all zero and blank

Is the PageReceived the correct embed to use after POST?
What is the easiest way to see the raw value being returned from the server?
« Last Edit: February 28, 2012, 05:51:29 AM by rupertvz »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NetWebClient - PageReceived to view response from server
« Reply #1 on: February 28, 2012, 06:43:14 AM »
put code in ErrorTrap, and PageReceived methods.
these methods will be called with the response (or the error).
You don't call the method yourself, it will be called for you when the data is ready.

the received page is in self.page
but of course, they may send back "nothing".

cheers
Bruce

rupertvz

  • Sr. Member
  • ****
  • Posts: 326
    • View Profile
    • Email
Re: NetWebClient - PageReceived to view response from server
« Reply #2 on: March 01, 2012, 03:16:49 AM »
Hi Bruce,

Thanks, I am receiving the reply in Self.Page.
All is looking good, just one question:

The URL is suppose to redirect to the credit card company's website.
I am doing the post, receiving the reply, but not being redirected?


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NetWebClient - PageReceived to view response from server
« Reply #3 on: March 01, 2012, 05:37:51 AM »
>> The URL is suppose to redirect to the credit card company's website. I am doing the post, receiving the reply, but not being redirected?

um. So you have a web client class.
It gets a reply.
does the reply contain the instruction to redirect?

I'm not at all sure I understand what you're asking.

cheers
Bruce


rupertvz

  • Sr. Member
  • ****
  • Posts: 326
    • View Profile
    • Email
Re: NetWebClient - PageReceived to view response from server
« Reply #4 on: March 01, 2012, 07:46:13 AM »
Hi Bruce,

Perhaps I am using the wrong class / method for the application?
As per my post, I am using NetWebClient, POST()

The credit card company indicates an HTML form, method = "POST"
With values passed to their system.
ALSO in the same instance a page on their server should be opened where the user should fill in the credit card information.

The CC company accepts all the CC details on their SSL site, and processes the payment.

So currently I am posting the values to their URL and receive a response.
The response indicates credit card number missing, etc, but I am not suppose to pass the credit card details to them, the user should fill these in, on the CC site.

The example they provided:

<form method="POST" action="URL">
<input type = "hidden" name="p1" value = "a">
<input type = "hidden" name="p2" value = "b">
etc. etc. etc.
</form>

Where "p1" is the variable on their system and "a" is the value of the variable.

Would this HTML page normally pass the values and open the destination page?

So to answer your question;  the reply does not say anything about redirection,
But I have to open a page on their server and at the same time pass values to them.

I am not sure what I am missing?
« Last Edit: March 01, 2012, 09:49:32 AM by rupertvz »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NetWebClient - PageReceived to view response from server
« Reply #5 on: March 01, 2012, 09:23:21 PM »
I think if you're following their docs  you're supposed to direct your user to their page. They see the page, fill it in etc.
You can do that using a button on a form - set the URL of the button to their URL, and add Hidden values to the form for anything else you want to send along.

The alternative approach, of using a web client, means you must completely duplicate what the user would do - including all interactions, pass data and so on.

you're confusing the two concepts together, which is why we're both confused.

cheers
Bruce

rupertvz

  • Sr. Member
  • ****
  • Posts: 326
    • View Profile
    • Email
Re: NetWebClient - PageReceived to view response from server
« Reply #6 on: March 02, 2012, 01:36:57 AM »
Hi Bruce,

Thanks for your help ...

I went through their documentation again. 

Forward Values
I have added a button to the main NetWebForm(Wizard), redirecting the user to their secure page.
Where do I include the 'hidden' values for the button to be passed onto their page?.

Return Values
We have to specify a return URL for their system to return the result-values back to us.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NetWebClient - PageReceived to view response from server
« Reply #7 on: March 02, 2012, 02:27:04 AM »
>> Where do I include the 'hidden' values for the button to be passed onto their page?.

just add fields to the form of type "hidden".

>> We have to specify a return URL for their system to return the result-values back to us.

cool. So probably a NetWebPage in your app.

cheers
Bruce