NetTalk Central

Recent Posts

Pages: [1] 2 3 ... 10
1
The Rest - Ask For Help / Re: How to set the HTTP headers
« Last post by Jane on January 26, 2020, 01:44:13 PM »
I've found it useful to experiment with the web client in the basic NetTalk demo program to get bits of communication going with an external API, then copying that code into my own app.

FWIW, here's some code I use for API calls to one service:
Quote
    ThisWebClient.SetAllHeadersDefault()

    ThisWebClient.HeaderOnly = 0
    ThisWebClient.Cookie = ''
    ThisWebClient.CustomHeader = 'Authorization: Bearer '&clip(pToken)
    ThisWebClient.Referer = ''   
    ThisWebClient.AsyncOpenTimeOut = 2200       ! 22 seconds
    ThisWebClient.InActiveTimeout = GLO:QueryTimeout            ! 6000             
    ThisWebClient.SSLMethod = NET:SSLMethodTLS
    ThisWebClient.HTTPVersion = 'HTTP/1.1'
    ThisWebClient.ContentType = 'application/x-www-form-urlencoded'
    ThisWebClient.ConnectionKeepAlive = FALSE
    ThisWebClient.CanUseProxy = GLO:CanUseProxy
    ThisWebClient.Fetch(clip(pURL))

and this is the POST to the same service to get its bearer oauth token:

Quote
        ThisWebClient.SetAllHeadersDefault()

        ThisWebClient.HeaderOnly = 0
        ThisWebClient.Cookie = ''
        ThisWebClient.CustomHeader = ''
        ThisWebClient.Referer = ''
        ThisWebClient.Authorization = ThisWebClient.CreateAuthorizationString (LOC:Key, LOC:Secret, Net:WebBasicAuthentication,_AuthNoWrap) 
        ThisWebClient.AsyncOpenTimeOut = 1200       ! 12 seconds
        ThisWebClient.InActiveTimeout = 2000        ! 20 seconds     
        ThisWebClient.SSLMethod = NET:SSLMethodTLS
        ThisWebClient.HTTPVersion = 'HTTP/1.1'
        ThisWebClient.ContentType = 'application/x-www-form-urlencoded'
        ThisWebClient.ConnectionKeepAlive = FALSE
        ThisWebClient.CanUseProxy = GLO:CanUseProxy

     
    ThisWebClient.Post(LOC:URL,clip(LOC:PostString)) 
2
The Rest - Ask For Help / How to set the HTTP headers
« Last post by Rene Simons on January 26, 2020, 08:54:19 AM »
Hi all,

I have acces to an API where I can obtain inof I need for my web-application.
To use it I need to set the HTTP-headers. The specs for the header can be seen in the attached image.
I have no idea on how to set these headers.

I guess I can call the URL after I set the HTTP-headers.
And then retrieve the received result in the Pagereceived embed.

Thanks in advance for helping me out here.

René

3
Web Server - Ask For Help / Re: NetWebForm - Set Focus
« Last post by Graham on January 23, 2020, 07:14:15 AM »
When you good, you're good...  :)

Sure that will work, thank you
4
Web Server - Ask For Help / Re: NetWebForm - Set Focus
« Last post by Bruce on January 22, 2020, 11:27:17 PM »
well, I've made a "trivial" tweak, in the sense of letting you set the TabIndex directly.
So ultimately (for now) if the programmer wants to change the tab order then they'll need to set it explicitly.

cheers
Bruce
5
Web Server - Ask For Help / Re: WebServer connections growing
« Last post by Graham on January 22, 2020, 09:09:22 PM »
Hi Bruce,

Thanks for your thoughts and yeah, this is a sort of API Server which was cobbled together some 12 odd years ago.

Since running into this issues, I have refactored the WebClient side to be more "respectful" but to roll this out to all sites will take time.

I am investigating some other strange behaviour on this Win2008 box - if I find anything relevant/related, will let you know

Regards
Graham
6
Web Server - Ask For Help / Re: NetWebForm - Set Focus
« Last post by Graham on January 22, 2020, 08:41:01 PM »
Hi Bruce

Thanks for taking a look at this - can imagine it is non-trivial..
7
Web Server - Ask For Help / Re: NetMaps zoom
« Last post by Bruce on January 21, 2020, 10:27:37 PM »
yes
8
Web Server - Ask For Help / Re: NetWebForm - Set Focus
« Last post by Bruce on January 20, 2020, 09:55:58 PM »
The example works, but only if you actually enter something for the password field. If you just tab over it, then it does nothing (which would be a problem).

I will need to add a property so that you can set the tabindex for each field, so the order is set at generate time. That's more complicated than it seems though, because I allow forms to be embedded in forms, and that will affect things...

I'll keep you posted.

cheers
Bruce

9
Web Server - Ask For Help / Re: Address autocomplete service
« Last post by Bruce on January 20, 2020, 09:40:51 PM »
Hi Johan,

NetTalk has classes for integrating with the HERE api, and that does it, so that's somewhere to start.
I've also heard good things about melissa.com, but I've not used them myself yet.

cheers
Bruce
10
Web Server - Ask For Help / Re: WebServer connections growing
« Last post by Bruce on January 20, 2020, 09:37:33 PM »
Hi Graham,

What you are seeing is not the norm, so to determine the cause it's helpful to understand what you are doing that is "not normal".

You indicate that this is an API type app (using NetWebPages) - which suggests that your client software is a program rather than a browser. It's possible your client program is not closing connections correctly?

One change I can see is that over the years the server timeout was turned off, so the server won't time-out idle client connections. You could set that back if you like (say to 2 minutes or whatever works for you.) I'm talking about connection timeouts here, not session timeouts (that's a completely different discussion, and does not appear to be in play.)

My gut is that your clients are not correctly closing the connections once they are done with the request. So either they should be fixed (to respect the HTTP protocol) or some proxy is between you and the clients and is not closing connections.

So either fix the clients, or set the server connection timeout.

cheers
Bruce
Pages: [1] 2 3 ... 10