NetTalk Central

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Jane

Pages: [1] 2 3 ... 8

The NT history shows the error Don Ridley was reporting was fixed in 11.23.

Web Server - Ask For Help / Re: Open File Question
« on: February 17, 2020, 09:12:03 AM »

Some things (particularly mobile devices) will really want everything in the chain.

That said, you can download the chain items separately (as you mention in your first post).

There are specific instructions for NT as to how you need to paste together the server's certificate and any intermediate/root certificates.



Web Server - Ask For Help / Re: Parent/Child Issue
« on: February 09, 2020, 05:25:34 PM »
Just as a generic comment, Ken....  if you truly mean auto-incrementing as in LONGs configured that way in the dictionary...  that's not the best paradigm.

Particularly if you start looking at doing mobile apps down the road, you're better off having a GUID as a primary key.

I can't speak to the specific example you're working with.  But if you prime the GUID in the parent, you then know what it's going to be and can use that GUID as the link for child records.  Then when you finally save the parent, everything should match up.



The Rest - Ask For Help / Re: How to set the HTTP headers
« on: January 30, 2020, 08:42:15 AM »
I've only done one significant API project, Rene, so my experience is limited.  But this one has been working fine for a year and a half and FWIW, this is the approach I took.

Other than getting the bearer token, my other interactions involve a ThisWebClient.Fetch method.

I've packaged that method in a separate Window procedure (SendGetPacket), and each of the data items I'm calling uses that procedure.

The prototype for SendGetPacket is (STRING pURL, STRING pToken,StringTheory pST),LONG

The URL is built by the calling procedure to have exactly what is needed for this particular fetch.  The token is...  um... the bearer token.  And the StringTheory object is what will receive the data in the calling procedure.

On EVENT:OpenWindow, SendGetPacket runs the Fetch code I pasted in my earlier message.

There's the ErrorTrap code copied directly from Bruce's example.

There's no doubt a better way to do the next bit, but I wrote something that worked and haven't bothered trying to improve that.  SendGetPacket has its own StringTheory object (ST1) which I just use to make sure there's a '200' success response in what I've received.  LOC:RV is the LONG for the prototype's return.

In the ThisWebClient,PageReceived, after the parent, I have this code to remove the header and to put the body of what was received into the StringTheory object passed by the calling procedure:

                LOC:ResultLine = ST1.GetLine(1)
            if Instring('200',LOC:ResultLine,1,1)
                LOC:RV = TRUE
                LOC:RV = FALSE
                if Instring('ERROR',upper(LOC:ResultLine),1,1)
                    loop ERR# = 1 to ST1.Records()
                        if instring('detailedm',ST1.GetLine(ERR#) ,1,1)
                        end ! if
                    end ! loop                   
                end ! if               
            end ! if   

The procedures calling this are also Window procedures, and I have one of them customized for each data item I'm receiving (doctors, patient appointments, service locations, etc.)
The "Web" object below is a simple class I wrote derived from StringTheory to built the parameter string URLs for the API calls.

As you can see, I basically prepare the URL, call my ClientSendPacket and pass it that URL and my calling StringTheory object. 
Then load the contents of the StringTheory object into a jfiles object and do whatever processing after that.

        web.SetBaseURL(clip(GLO:PracticeID)&'/departments' )
        web.AddParm('showalldepartments='&choose(pShowAllDepts,'true','false')  )
        web.AddParm('providerlist='&choose(pProviderList,'true','false') )       





The Rest - Ask For Help / Re: How to set the HTTP headers
« 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:

    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

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


        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


Web Server - Ask For Help / Re: Don Ridley - Capesoft Document Index ????
« on: January 05, 2020, 03:49:51 PM »

When you're bored, just sit back with the cat on your knee and browse through the NetTalk docs  ;)

Also a good idea to compile and play with various examples. 

In this case, a link to the PDF Don posted is provided in the documentation mention of the multi-site example:


Browsers are hard-coded to try to talk to port 80 for HTTP and port 443 for HTTPS.  If you need to talk to a port other than that, you need to tell the browser what the protocol is (HTTPS) and what port the server is listening on.

I think your options are pretty much
1.  Do what you're presently doing (specify the port number for the second website).
2.  Do whatever Amazon requires to get a second IP address.  Use that for the second site and then it will be able to respond to a plain HTTPS on the default port 443.
3.  Go the multi-site route, where the host app listens on port 443 and passes the traffic along to whichever DLL has been requested.

Happy New Year!


Web Server - Ask For Help / Re: Example 72 with a Text file
« on: December 15, 2019, 01:59:17 PM »
I haven't done it, Richard.  But I'd think you could combine the two.

Create the report or file as in example 72.

But in the Value::FileProgress routine, instead of creating a URL as that example does, do something like example 40 (p_web.HeaderDetails.ContentDisposition = 'attachment; filename="   ... etc.)

I think the "attachment" in the header is what's telling the browser not to try to open the file directly, and is apparently the behavior you're looking for.



Web Server - Ask For Help / Re: Example 72 with a Text file
« on: December 14, 2019, 09:13:48 PM »
Sure, right-click works.

But example 40 works with a regular click (in case you have trouble training your users).

Web Server - Ask For Help / Re: Example 72 with a Text file
« on: December 14, 2019, 09:34:12 AM »
Try example 40 (FileDownload) instead.

First question - has this box ever worked for a secure NT server?
Can you successfully run the current (ships with NT) version of openssl.exe on the box?

If not, you may have the famous "Visual Studio runtime 2017 not installed" trick happening:

The internal cert we use where I contract is several years old and I'd guess the IT guy wouldn't remember details of getting it.

For my own internal test NT servers using a commercial cert, I've used openssl to generate the key and certificate request and pasted the CSR into the CA vendor's website.  If that were not an option, I'd probably select Apache on their website.

Be sure that the private key file in the NT certificates folder is not password-protected.


At a guess, you need a newer version of String Theory.

Line 79 of  3.11 (which is the version I have at the moment) has

st:NoPadding        equate(2)

So it looks as if Bruce has made some change to Base64Encode since the version that you're using.



Yes, the settings stuff has changed quite a bit since NT9.

You might watch NT webinar 185, starting at 12 minutes in, where Bruce shows how to delete the old control template and put in the new version.

In general, I find that control templates seem very sensitive toward their parents.
So I make sure their parents are solid.

For example, if I want to put a toolbar on a window, and then a Close control template on the toolbar... I'll first put the toolbar on the window.  Then exit and save the window.  Then go back and put the Close button on it. 


Pages: [1] 2 3 ... 8