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.


Topics - Poul

Pages: [1] 2 3
1
Currently at the end of each ServiceMethod I am adding  code to kill my session.
Without it, i must rely on the session timeout which keeps many sessions opens for no good reason
as i will not reuse the session. All to maintain the stateless aspect of a RESTful API.

Code: [Select]
!----------------------------------------------------------------------------------------------------
! All your actual code for this method goes here. The "incoming parameter variables" have been primed
!----------------------------------------------------------------------------------------------------
ServiceMethod  routine
! Start of "Service Method Routine"
! [Priority 4000]
...

  p_web.SetSessionLoggedIn(0)   !<<-- template option?
! End of "Service Method Routine"

! [Priority 1300]
This works fine, but i am lazy and sometimes forget, is there a place where i can embed this once - for all servicemethods , so the session ends immediately after any service method call? Or perhaps more simply can the template give me an option to logoff/end the session and write this line of code?  (or take me to a common wrap up/kill method were i can write this once)

poul




2
Web Server - Ask For Help / NetWebmethod: Only Serve if Secure TLS
« on: February 21, 2017, 03:34:11 PM »
Hello,
i am trying to confirm something as my web-service behaves different than i expect.

i have setup a self signed certificate (The server is Configured to USE TLS)
a regular web page works as expected from a browser.
I  can use both Basic or Digest HTTP authentication for a webservice which appears to be working fine.

as an example,
for an  employees NetWebservice Method i have  set the security to "Only Serve if Secure TLS"

a Client that does a "GET for https://myserverapi/v1/employees" appears to work fine.

but a "GET for http://myserverapi/v1/employees" also works, i was expecting nothing to return or an error.

How can i tell if the connection is truly thru TLS or not?
The SSL method seems to indicate that its TRUE.

If i turn off the "Only Serve if Secure TLS" for the method, the SSL flag still indicates true
Does the server setting take precedence over the http(s) protocol in the request?

I'd like to test and enforce that https:// has been specified by the client explicitly for any web-service call.

is this something i should be concerned over or is this expected behavior.

TIA
poul

3
Web Server - Ask For Help / WWW-Authenticate - Challenge
« on: January 25, 2017, 08:18:38 AM »
Hi Bruce,

I know you plan to add something to enable the www-authenticate header response with a 401 in 9.18.
Will that include or can you consider adding support or an embed point so it can send a full challenge
Including nonce,opaque etc

poul


4
Web Server - Ask For Help / No SessionID for a REST response
« on: January 20, 2017, 03:21:24 PM »
So i have my webservice  mostly  RESTful now,
The only bit of house keeping i would like to do is not set the SESSIONID cookie.
I can delete the cookie in my webservice method but it leaves an artifact in the Response
is there a way to prevent the "Set-Cookie: SESSIONID ..." from ever happening?


Code: [Select]
HTTP/1.1 200 OK
Date: Fri, 20 Jan 2017 23:04:43 GMT
Server: NetTalk-WebServer/9.13
Content-Length: 4308
Content-Encoding: gzip
Content-Type: application/json
Set-Cookie: SESSIONID=; expires=Tue, 07 Apr 1801 05:00:00 GMT;; path=/
Connection: close
X-Frame-Options: sameorigin

ie Never appear in the response header
Code: [Select]
HTTP/1.1 200 OK
Date: Fri, 20 Jan 2017 23:04:43 GMT
Server: NetTalk-WebServer/9.13
Content-Length: 4308
Content-Encoding: gzip
Content-Type: application/json
Connection: close
X-Frame-Options: sameorigin

poul

5
Web Server - Ask For Help / Implementing HTTP Authentication on a Server
« on: January 16, 2017, 10:24:48 AM »
Hello, are there any examples,documentation,tips,webinars?

My main goal is to simplify REST access for a WebService, but i would also like to have it as the default for a webbrowser.
(I am returning XML by default to the Browser, but JSON for the Webclients who request it)

I see lots of plumbing bits for the Authentication/token etc, but nothing the puts it altogether

For example: in my webservice method i can set it to "user must be logged in"
Which does an immediate "401 Unauthorizd"
I suppose a Webclient would know to send the Credentials, but i believe i should be
putting something like "WWW-Authenticate: Basic" in the header.
is there a simple way to do that before the
 
Code: [Select]
If p_web.GetSessionLoggedIn() = 0
    p_web.SendError (401,'Unauthorized', 'A login is required to view this page')
    Return
end

my current assumption is that i have to handle things myself in the CheckForToken routine
but its unclear if that's the intention or best place.

poul

6
Web Server - Ask For Help / If Condition fails - Hide
« on: October 18, 2016, 11:54:19 AM »
On the Form->Insert tab for a NetwebBrowse Template there is a Place for a condition
which i set to a session value that indicates true to show the Insert button, depending on some user properties.

Immediately following that prompt is "if condition fails " followed by a drop box which seems to indicate i can either Hide or Disable the Insert button,
but it does not seem to work,  if i choose disable nothing appears. I am expecting the Button to display as disabled.


poul

NT 9.13





7
Web Server - Ask For Help / REST: GET Collection pagination reponse
« on: September 29, 2016, 02:27:57 PM »
When one does a REST request like  "GET /myservice/orders" all the rows in the collection can be returned.
the result can be quite large so, the Result needs to be paged, I do not see anything baked in..

Some research has me considering some 'standard approaches' but before i start coding,
it seems that Nettalk may already have or certainly would benefit from a standard  (perhaps NT friendly or optimized) approach
that facilitates clients (especially NT clients)  easily consuming NT REST services.

I know there is recent activity in syncing data ("Beyond SQL..."), but are there any plans/suggestions/hooks/examples or must one roll their own?
I am thinking of filters on the url,  - with the paging state values in metadata in the HEADERS and/or BODY of a RESTful  response.

poul



8
Web Server - Ask For Help / SetHeader200
« on: September 28, 2016, 01:31:27 PM »
Hi Bruce
in NetWeb.clw you have some code like this:

Code: [Select]
NetWebServerWorkerBase.SetHeader200 Procedure(Long p_cache=net:Cache)
  code
      !self.HeaderDetails.ContentLength is set before, or after, calling this
  if self.ReplyResponseNumber <> ''
    self.HeaderDetails.ResponseNumber = self.ReplyResponseNumber
  else
    self.HeaderDetails.ResponseNumber = '200'
  end
  self.HeaderDetails.ResponseString = 'OK'
...
if In a WebServiceMethod I set the p_web.ResponseNumber to say 404
i still get the ResponseString  as 'OK'
Could you make that conditional so i could set p_web.ResponseString =  "NOT FOUND" at the same time?
or perhaps provide a more generalized way(function) of populating  the ResponseString  based on the response number.

poul

9
I have A Webservice using json and a REST GET If i ask for a Valid code
Code: [Select]
GET /DatabaseService/dbCommodity/klbit responds as expected with
Code: [Select]
HTTP/1.1 200 OK
Date: Fri, 23 Sep 2016 21:14:44 GMT
Server: NetTalk-WebServer/9.13
Content-Length: 158
Content-Type: application/json
Set-Cookie: SESSIONID=kM4TrveL7m2KOy7c; path=/; HttpOnly
Connection: close
X-Frame-Options: sameorigin

{
"dbCommodity_response" : {
"commodity_details" : [
{
"commodity" : "NEWSPRINT",
"pouom" : "MT",
"classid" : "NWSP"
}
]
}
}

but if i ask for an invalid code
Code: [Select]
GET /DatabaseService/dbCommodity/BADCODEit responds like this:
Code: [Select]
HTTP/1.1 200 OK
Date: Fri, 23 Sep 2016 21:15:29 GMT
Server: NetTalk-WebServer/9.13
Content-Length: 67
Content-Type: application/json
Set-Cookie: SESSIONID=Il7Ozels3LqdiNk8; path=/; HttpOnly
Connection: close
X-Frame-Options: sameorigin

{
"dbCommodity_response" : {
"commodity_details" : null
}
}

Which is sort of true but should it be responding with  404 (Not Found)?
rather than 200? And where/how is the best place in a NetwebServiceMethod to do this?

tia poul

10
Web Server - Ask For Help / Message on a Popup.
« on: September 12, 2016, 09:56:46 AM »
for years, I used code like this when calling a form from a browse,
at the  top of  GenerateForm Routine for the Form:
Code: [Select]
if some condition
   packet.SetValue(  'Security Restriction (' & P_WEB.GSV('Loc:PrivatePage') & '), This Action is Not permitted for '  & p_web.gsv('ProfileLoginID') & '!'  )
   do SendPacket
   Return -3
end
My menus are such that this would  show the message,  that would appear under my menu - and stopping the action.
(Avoiding what Nettalk does by default- not serving the page with the user unaware of why?)

if the form is a popup, this does not work, the Return works but you get a blank (incomplete) popup, i would like to communicate to the user the reason that the form will not let them continue..

I was wondering if someone has a suggestion on how to  accomplish  showing an alert or  message on the popup for this circumstance?


TIA
poul

11
Web Server - Ask For Help / Truncated Session Values
« on: August 30, 2016, 12:10:03 PM »
In NT8 i use a technique to save filters into a Sessionvalue that gets used in a related Browse where the filter is just set with the sessionvalue.
It has worked great for some time.

I am seeing more instances where the sessionvalue appears to get truncated, so my filter is truncated.
Its tricky to  duplicate, it seems to work initially then as i change the sessionvalue the problem can occur.
(it might be aggravated by the serverstate saves!? as i see it more when i am testing)

in 9.06 I noticed this in version history
Quote
Fix: Session Values could be not-updated if value changed from very short to very long

Bruce could you shed some light on how long this issue was present - was it just new in 9 or was the issue pre-existing, as it smells similar to  my experience. Might some variation exist in NT8? whats very long vs very short?

Today, I have taken to deleting the session value before setting it, as my work-around which I think helps for my specific cases, time will tell., but obviously session values are used all over the place...

I am posed to update this to NT9, but for various reasons, not yet. I am wondering if there was a Fix that could be retrofitted for NT8

tia
poul

12
Web Server - Ask For Help / Exporting Columns with Conditional Values
« on: April 08, 2016, 05:09:24 AM »
The entries on the Conditional tab for a Column - appear to be ignored on a Export

13
Web Server - Ask For Help / Export to EXCEL does not Count
« on: March 11, 2016, 12:06:48 PM »
When I have totals on a browse and include a count,
the Excel generated on an Export is something like  =COUNT(E4:E99)

But my column contains a mix of Numbers and AlphaNumerics.(Reference Numbers)
so is drastically not a count of all the rows.in the range.

The COUNT function counts the number of cells that contain numbers,
The COUNTA function counts the number of cells that are not empty in a range.
 
COUNTA would be a better choice, i think

poul
(nt8) Excel 2013

14
Web Server - Ask For Help / Double Drop Menu and IE11 using Touch
« on: December 15, 2015, 08:45:12 AM »
With IE the DropDown menu is workable with a mouse (suffers from some display alignment issues)
but with a touch interface the drop down menu disappears before the user
can make a selection.

Are they any techniques that can make it 'sticky'.

15
Web Server - Ask For Help / Logging in with Iphone
« on: November 17, 2015, 02:04:34 PM »
Every once in a while I check my NT development work by browsing
with my iphone, today, i cannot get past the login,
which has been unchanged for quite some time.

I just tried the web3  examples and i get similar results.
i can enter the username and password, but it ignores me after that.

has something changed in NT in this area,recently? I don't think I have changed
anything on my Iphone/safari settings.

Are there any recommended settings/guidelines?

it works fine from all desktop browsers.

My nettalk is 8.64
My iphone is an iphone6

Pages: [1] 2 3