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.
1
The Rest - Ask For Help / Re: Need embed point for calculations, please
« on: February 09, 2025, 08:09:13 PM »
As a starting point, I'd try this embed.
2
Web Server - Ask For Help / Re: Microservices?
« on: February 06, 2025, 12:28:50 PM »
What is the problem you're trying to solve?
3
Web Server - Ask For Help / Re: No locator/sorts in other than desktop screen size
« on: January 18, 2025, 02:48:30 PM »
Poul,
Don't know what you did with editing the shipping theme that didn't work, but the custom.css you're using won't do what you want.
What you're showing doesn't change the behavior of Bruce's css. You need to include something for that selector that overrides what's in the original css.
Something like this, for example, should work in your custom.css:
Don't know what you did with editing the shipping theme that didn't work, but the custom.css you're using won't do what you want.
What you're showing doesn't change the behavior of Bruce's css. You need to include something for that selector that overrides what's in the original css.
Something like this, for example, should work in your custom.css:
Code: [Select]
@media (max-width: 1024px) { /*for small screens */
.nt-browse-row-header{
display:flex!important;
}
}
4
Web Server - Ask For Help / Re: 2 way certificate authentication
« on: January 08, 2025, 03:10:58 PM »
Thanks for the update, Joep,
Glad you got it working. You didn't attach a picture, but then it's a *hidden* window
As you've found, the key is to think of the client part as a client and the webserver part as a webserver.
Good job!
Glad you got it working. You didn't attach a picture, but then it's a *hidden* window

As you've found, the key is to think of the client part as a client and the webserver part as a webserver.
Good job!
5
Web Server - Ask For Help / Re: Cannot load as a Service -wrong path to executable
« on: December 29, 2024, 03:26:04 PM »
It has nothing to do with recompiling. When you ran the app with /IS the service information was created in the Registry.
If the wrong path is displaying on the Properties page in the services.msc app, easiest is to uninstall the service and reinstall it in the correct folder.
Or you could edit it in the Registry.
If the wrong path is displaying on the Properties page in the services.msc app, easiest is to uninstall the service and reinstall it in the correct folder.
Or you could edit it in the Registry.
6
The Rest - Ask For Help / Re: Rest API - bad request reply
« on: December 29, 2024, 11:33:36 AM »
Johan,
As a first suggestion, try compiling with
Another tool I've found useful is to run Fiddler and use it to monitor traffic in and out. If you have an app (Postman, maybe?) that works and one that doesn't, that can be useful to compare what the two different apps are sending.
As a first suggestion, try compiling with
Code: [Select]
NetShowSend=>1
and then using debugview++Another tool I've found useful is to run Fiddler and use it to monitor traffic in and out. If you have an app (Postman, maybe?) that works and one that doesn't, that can be useful to compare what the two different apps are sending.
7
The Rest - Ask For Help / Re: Need help understanding NT commands
« on: December 27, 2024, 02:24:38 PM »
8
The Rest - Ask For Help / Re: Need help understanding NT commands
« on: December 26, 2024, 11:34:03 AM »
"C'mon, Man!" TM
Your post asks about ThisPage, RemoveHeader, and ServerResponse but you wanted the reply to be about how to use a token.
"C'mon, Man!" TM
In working with APIs I've found the best strategy FOR ME has been
1. Make it work with Postman
2. Using the Postman stuff as a guide, make it work with the NetDemo app.
3. Having figured that out, code it into my app.
In my apps that need to call an API I typically have two procedures.
1. Fetches a token. In my case, it first checks to see whether it has an existing token available that hasn't expired.
2. A generic "fetch stuff" API call.
The "fetch stuff" procedure (sendGetPacket) is a generic window procedure having a prototype of
The procedure that wants to fetch something creates the URL for the endpoint creates the required URL and passes the URL, the token, and a String Theory object to the sendGetPacket procedure. When it's done, the StringTheory parameter contains what I've fetched from the API endpoint and I do what I do with it in the calling procedure.
The sentGetPacket has this code, much of which is snipped out of the NetDemo web client procedure.
The EVENT:OpenWindow event has this embed
Other embeds:
This is all OLD CODE I wrote 6 1/2 years ago, but it's been working fine since then. YMMV. Much of it, as mentioned, appropriated from the handy dandy NetDemo example program. UD is the ClarionLive UltimateDebug object.
[edited] because I couldn't stand looking at the ugly pageReceived code I posted so I tweaked that app I pulled this from. [/edited]
HINT - that NetDemo example is handy
Your post asks about ThisPage, RemoveHeader, and ServerResponse but you wanted the reply to be about how to use a token.
"C'mon, Man!" TM

In working with APIs I've found the best strategy FOR ME has been
1. Make it work with Postman
2. Using the Postman stuff as a guide, make it work with the NetDemo app.
3. Having figured that out, code it into my app.
In my apps that need to call an API I typically have two procedures.
1. Fetches a token. In my case, it first checks to see whether it has an existing token available that hasn't expired.
2. A generic "fetch stuff" API call.
The "fetch stuff" procedure (sendGetPacket) is a generic window procedure having a prototype of
Code: [Select]
(STRING pURL, STRING pToken,StringTheory pST),LONG
The procedure that wants to fetch something creates the URL for the endpoint creates the required URL and passes the URL, the token, and a String Theory object to the sendGetPacket procedure. When it's done, the StringTheory parameter contains what I've fetched from the API endpoint and I do what I do with it in the calling procedure.
The sentGetPacket has this code, much of which is snipped out of the NetDemo web client procedure.
Code: [Select]
PacketSend ROUTINE
DATA
CODE
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 ! 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.ProxyServer = GLO:proxyServer
ThisWebClient.ProxyPort = GLO:proxyPort
ThisWebClient.Fetch(clip(pURL))
The EVENT:OpenWindow event has this embed
Code: [Select]
! End of "Window Event Handling"
OF EVENT:OpenWindow
! [Priority 5000]
DO PacketSend
Other embeds:
Code: [Select]
ThisWebClient.ErrorTrap PROCEDURE(string errorStr,string functionName)
! Start of "NetTalk Method Data Section"
! [Priority 5000]
! End of "NetTalk Method Data Section"
CODE
! Start of "NetTalk Method Executable Code Section"
! [Priority 2500]
if self.Error <> 0
ud.debug('error trap before parent '&clip(errorstr)&' '&clip(functionName)&' code='&ThisWebClient.Error)
AddLog('net client error '&clip(errorstr),0,0)
AddErrorLog('net client error '&clip(errorstr)&' url='&left(pURL,80))
post(event:closewindow)
end ! if
! Parent Call
PARENT.ErrorTrap(errorStr,functionName)
! [Priority 7500]
Code: [Select]
ThisWebClient.PageReceived PROCEDURE
! Start of "NetTalk Method Data Section"
! [Priority 5000]
! End of "NetTalk Method Data Section"
CODE
! Start of "NetTalk Method Executable Code Section"
! [Priority 2500]
! Parent Call
PARENT.PageReceived
! [Priority 7500]
IF self.ServerResponse = 200
self.RemoveHeader()
LOC:RV = TRUE
pST.SetValue(self.ThisPage.GetValue())
ELSE
LOC:RV = FALSE
END !IF
post(event:closewindow)
This is all OLD CODE I wrote 6 1/2 years ago, but it's been working fine since then. YMMV. Much of it, as mentioned, appropriated from the handy dandy NetDemo example program. UD is the ClarionLive UltimateDebug object.
[edited] because I couldn't stand looking at the ugly pageReceived code I posted so I tweaked that app I pulled this from. [/edited]
HINT - that NetDemo example is handy

9
The Rest - Ask For Help / Re: Need help understanding NT commands
« on: December 24, 2024, 12:11:10 PM »10
Web Server - Ask For Help / Re: 2 way certificate authentication
« on: December 19, 2024, 10:15:45 AM »Quote
What I also wanted to ask is how I can do the get from a netwebservice method?
I have used client certificates to authenticate to servers, but not from NetTalk. On this page there is some info on client-side certificates: https://www.capesoft.com/docs/NetTalk12/NetTalkWebClient.Htm Bruce may have further advice.
I have, however, built a web server that is at the same time both an API server and an API client, which is what you're apparently doing.
The API client part is built like any of the API client examples that ship with NetTalk. (Such as 77).
Because an API request is asynchronous, you need a window running on a separate thread with a webclient object. It authenticates to the server you're querying and fetches the data from that other server's API. The window is obviously never visible to anyone; it's just used for the asynchronous process. Once you've sorted the certificate authentication the rest will be quite straightforward.
11
Web Server - Ask For Help / Re: 2 way certificate authentication
« on: December 11, 2024, 01:31:46 PM »
Questions on terminology...
Are YOU accessing HIS API as a client? And he wants you to use a certificate to authenticate yourself (rather than something like name and password)?
If that's what is meant by "2 way certificate authentication" then I think you need to figure out to use a client certificate (signed by him) to authenticate yourself to his API. Remember that certificates have two basic (and partially independent) functions - encryption and authentication. Maybe use Postman to do some tests for accessing his API. And when you get that working, do the same with the NetDemo app.
Are YOU accessing HIS API as a client? And he wants you to use a certificate to authenticate yourself (rather than something like name and password)?
If that's what is meant by "2 way certificate authentication" then I think you need to figure out to use a client certificate (signed by him) to authenticate yourself to his API. Remember that certificates have two basic (and partially independent) functions - encryption and authentication. Maybe use Postman to do some tests for accessing his API. And when you get that working, do the same with the NetDemo app.
12
Web Server - Ask For Help / Re: h2 Header styling - trying to apply color
« on: November 21, 2024, 10:12:38 AM »
Of course, if you want ALL h2 elements in your app to be red it's easiest to put a line into your custom.css file
Remember that it doesn't take a period or hash mark before the h2 designation.
Code: [Select]
h2{color:red;}
Remember that it doesn't take a period or hash mark before the h2 designation.
13
Web Server - Ask For Help / Re: Settings for making web procedures not visible/accessible
« on: October 03, 2024, 06:59:21 AM »
Argh!
Yes, sorry, Johan. Appears that I zipped it before saving from IDE.
Attached is an updated zip.
But looks as if you put the code in about the same place as I did.
Jane
Yes, sorry, Johan. Appears that I zipped it before saving from IDE.
Attached is an updated zip.
But looks as if you put the code in about the same place as I did.
Jane
14
Web Server - Ask For Help / Re: Settings for making web procedures not visible/accessible
« on: October 01, 2024, 09:18:03 AM »
C10? Guess you like skinny templates 
Are you on NT 14, I hope?
Revised example C10/NT14 attached.
My code in the webhandler (line 14288 in p_web.SendFile procedure) looks for both procedure name and page name as specified on the procedure template. Forced to lower-case a few lines above.
Code in this example is:
case loc:filename
of 'johan' orof 'johanpage'
orof 'john' orof 'johnpage'
p_web.trace('case triggered')
p_web.SendError (404,'The page cannot be found', 'The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.')
return
end !case
Seems to work OK.
Cheers,
Jane

Are you on NT 14, I hope?
Revised example C10/NT14 attached.
My code in the webhandler (line 14288 in p_web.SendFile procedure) looks for both procedure name and page name as specified on the procedure template. Forced to lower-case a few lines above.
Code in this example is:
case loc:filename
of 'johan' orof 'johanpage'
orof 'john' orof 'johnpage'
p_web.trace('case triggered')
p_web.SendError (404,'The page cannot be found', 'The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.')
return
end !case
Seems to work OK.
Cheers,
Jane
15
Web Server - Ask For Help / Re: Settings for making web procedures not visible/accessible
« on: September 30, 2024, 12:12:24 PM »Quote
Something I have not looked at,
is to add code to serve "page not found" HTML
Fairly easy to do with a few lines of code in the webhandler.
Maybe something like the attached?
(Bruce page will serve, Johan and John pages will 404.)