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.
16
Web Server - Ask For Help / NetWebServiceMethod - parameter descriptions generated with two single quotes
« on: March 14, 2019, 09:53:10 PM »
Hi,
Where I've added a parameter description on a service method using single quotes, in the help generation of this parameter it doubles the quotes. How do I get this back to normal? See attached.
Using Clarion 11 and NT 11.07.
Thys
Where I've added a parameter description on a service method using single quotes, in the help generation of this parameter it doubles the quotes. How do I get this back to normal? See attached.
Using Clarion 11 and NT 11.07.
Thys
17
Web Server - Ask For Help / NetWebServiceMethod - problems withsort order in json.append(view)
« on: March 14, 2019, 03:35:17 AM »
Hi,
I have a view in the response of a call. On the template screen I set the sort order of the view to the NAME column of the table. But when the append statement is called to populate JSON like here:
jsonResults.append(MedicalAidView,'MedicalAid')
the sort order of NAME is ignored and the response is sorted by the primary key column. Is there a way to fix this please?
Thys
I have a view in the response of a call. On the template screen I set the sort order of the view to the NAME column of the table. But when the append statement is called to populate JSON like here:
jsonResults.append(MedicalAidView,'MedicalAid')
the sort order of NAME is ignored and the response is sorted by the primary key column. Is there a way to fix this please?
Thys
18
Web Server - Ask For Help / NetWebServiceMethod - Sync always activated?
« on: March 14, 2019, 02:34:23 AM »
Hi,
Although my DCT is already set up with timestamp columns, I'm not using them yet for syncing. On the APPS tab of the global extension template, "Allow Sync in Service Methods" and "Generate for Disconnected App" is not switched on. But the NewWebServiceMethod template still generates code for the timestamp columns.
Is there a setting to totally disregard syncing and not using the timestamp columns?
Thys
Although my DCT is already set up with timestamp columns, I'm not using them yet for syncing. On the APPS tab of the global extension template, "Allow Sync in Service Methods" and "Generate for Disconnected App" is not switched on. But the NewWebServiceMethod template still generates code for the timestamp columns.
Is there a setting to totally disregard syncing and not using the timestamp columns?
Thys
19
Web Server - Ask For Help / Base64 question
« on: March 08, 2019, 12:01:01 AM »
Hi.
This is not a NetTalk question, but rather a general question which I experience in my NetTalk web service.
We have an MS SQL table where the owner decided to have a "Photo" column of type varbinary(max) to store an image. The way that I've dealt with images before, is to rather have a varchar(max) column type and store the image as a Base64-encoded value.
For this varbinary(max) column, I use Stringtheory to decode the Base64 value received, but it still causes MS SQL to throw an error - I suppose because Clarion is trying to save a string instead of binary values. I have tried changing the type in the dictionary to both BLOB and PICTURE, both result in a Clarion runtime error.
Is there anyone that has dealt within this data type before?
Thys
This is not a NetTalk question, but rather a general question which I experience in my NetTalk web service.
We have an MS SQL table where the owner decided to have a "Photo" column of type varbinary(max) to store an image. The way that I've dealt with images before, is to rather have a varchar(max) column type and store the image as a Base64-encoded value.
For this varbinary(max) column, I use Stringtheory to decode the Base64 value received, but it still causes MS SQL to throw an error - I suppose because Clarion is trying to save a string instead of binary values. I have tried changing the type in the dictionary to both BLOB and PICTURE, both result in a Clarion runtime error.
Is there anyone that has dealt within this data type before?
Thys
20
Web Server - Ask For Help / NetWebServiceMethod - p_web.FileErrorCode() and p_web.FileError() not showing
« on: March 04, 2019, 03:57:36 AM »
Hi,
In the InsertRecord: routine, there is this line that is called when an insert error ocurred:
p_web.AddServiceError(Err,'dbRoleMember',p_web.RecordIdentifier(RoleMember), 'Error when attempting to Insert a record [' & p_web.ErrorCode() &'] ' & p_web.Error() & ' [' & [p_web.FileErrorCode() & '] ' & p_web.FileError(), '')
This is the JSON response describing the error:
{
"dbRoleMember_response": {
"queue": [
{
"ERRORNUMBER": 5,
"ERRORPOSITION": "dbRoleMember",
"ERRORRECORDID": "ROM_GUID=",
"ERRORDESCRIPTION": "Error when attempting to Insert a record [90] File System Error",
"ERRORRECOMMENDATION": ""
}
]
}
}
You will see that p_web.FileErrorCode() and p_web.FileError() does not show anything in the response - although it should have values because the database is PostgreSQL and I checked them individually and there are values. The square brackets in that same portion of code also don't show, so I think it could be a cstring issue with the return value of p_web.Error() that could include a terminating-0 character, and therefore the rest of the string is left blank.
Thanks
Thys
In the InsertRecord: routine, there is this line that is called when an insert error ocurred:
p_web.AddServiceError(Err,'dbRoleMember',p_web.RecordIdentifier(RoleMember), 'Error when attempting to Insert a record [' & p_web.ErrorCode() &'] ' & p_web.Error() & ' [' & [p_web.FileErrorCode() & '] ' & p_web.FileError(), '')
This is the JSON response describing the error:
{
"dbRoleMember_response": {
"queue": [
{
"ERRORNUMBER": 5,
"ERRORPOSITION": "dbRoleMember",
"ERRORRECORDID": "ROM_GUID=",
"ERRORDESCRIPTION": "Error when attempting to Insert a record [90] File System Error",
"ERRORRECOMMENDATION": ""
}
]
}
}
You will see that p_web.FileErrorCode() and p_web.FileError() does not show anything in the response - although it should have values because the database is PostgreSQL and I checked them individually and there are values. The square brackets in that same portion of code also don't show, so I think it could be a cstring issue with the return value of p_web.Error() that could include a terminating-0 character, and therefore the rest of the string is left blank.
Thanks
Thys
21
Web Server - Ask For Help / NetWebServiceMethod - CheckForDuplicates find duplicate without any records
« on: February 28, 2019, 04:08:05 AM »
Hi,
I have several db-methods that each gives an error when inserting a new record:
Cannot save a duplicate record. Record is duplicating another on the following fields:OBJ__GUID = 91ZJQHTR4IJ8AZ7L
The error is generated in the p_web.CheckForDuplicates method, but there are no existing records in those tables. On all of the tables, the database (PostgreSQL) generates the primary key column value, so Clarion does not touch the column (using READONLY on the external column name in the DCT). I have NT 10.35 on Clarion 11.
Any ideas?
Thys
I have several db-methods that each gives an error when inserting a new record:
Cannot save a duplicate record. Record is duplicating another on the following fields:OBJ__GUID = 91ZJQHTR4IJ8AZ7L
The error is generated in the p_web.CheckForDuplicates method, but there are no existing records in those tables. On all of the tables, the database (PostgreSQL) generates the primary key column value, so Clarion does not touch the column (using READONLY on the external column name in the DCT). I have NT 10.35 on Clarion 11.
Any ideas?
Thys
22
Your Views and Comments / Password reset
« on: February 06, 2019, 10:43:27 PM »
Hi,
Is there a way to have my account password reset please? I logged in to NetTalk Central with one browser and forgot my password, so I can't log in from another browser or another workstation.
Thys
Is there a way to have my account password reset please? I logged in to NetTalk Central with one browser and forgot my password, so I can't log in from another browser or another workstation.
Thys
23
Web Server - Ask For Help / LE cert does not get created
« on: February 01, 2019, 05:24:04 AM »
Hi,
I've added a settings tab to the WebServer procedure, for an older app. For some reason the CRT file does not get created. Attached are screenshots showing the setup and the logs.
Any ideas, please?
Thys
I've added a settings tab to the WebServer procedure, for an older app. For some reason the CRT file does not get created. Attached are screenshots showing the setup and the logs.
Any ideas, please?
Thys
24
Web Server - Ask For Help / NetWebClient - async call
« on: January 14, 2019, 10:10:22 PM »
Hi,
I need to do a GET to a Google service that requires an asynchronous client call. The AsyncOpenUse property is 0 by default - meaning that it makes a synchronous call by default. When changed to 1 (implying AsyncOpenUse = true) anywhere (Init or before Open), the service keeps on rejecting the call saying it's not asynchronous. Is there another way to set the call to be asynchronous?
Thys
I need to do a GET to a Google service that requires an asynchronous client call. The AsyncOpenUse property is 0 by default - meaning that it makes a synchronous call by default. When changed to 1 (implying AsyncOpenUse = true) anywhere (Init or before Open), the service keeps on rejecting the call saying it's not asynchronous. Is there another way to set the call to be asynchronous?
Thys
25
Web Server - Ask For Help / NetWebService - HTTP status codes for REST
« on: September 26, 2018, 09:24:29 PM »
Hi,
One of the REST guidelines is the use of HTTP status codes for better communication, not just for 200 OK or 404 Page Not Found. I've noticed that, although NT has a SendError method with which this status code can be set, most of the normal responses are handled nicely by NT.
To be able to build in more meaning in responses using the status codes, will the SendError method be the best to use? Examples could be 202 Accepted, 206 Partial Content, 301 Moved Permanently etc. - all of which may benefit the comms with clients.
Thanks
Thys
One of the REST guidelines is the use of HTTP status codes for better communication, not just for 200 OK or 404 Page Not Found. I've noticed that, although NT has a SendError method with which this status code can be set, most of the normal responses are handled nicely by NT.
To be able to build in more meaning in responses using the status codes, will the SendError method be the best to use? Examples could be 202 Accepted, 206 Partial Content, 301 Moved Permanently etc. - all of which may benefit the comms with clients.
Thanks
Thys
26
Web Server - Ask For Help / NetWebServiceMethod - JSONClass question
« on: July 20, 2018, 02:08:37 AM »
Hi,
In a webservice method, I want to append a JSON object to the JSON response. But the resultant object is not properly formatted.
Here is the code where the JSON object is added to the response:
st.SetValue (result)
js.Start ()
js.Load (st)
jsonResults.Append (js)
Here is the JSON that is returned:
{
"utQuery_response":
{
{
"list":[{"ClientNo":453,"Name":"Mondi"},{"ClientNo":732,"Name":"Meyersdal Shopping Centre"}]
}
}
}
The problem seems to be the extra pair of curly bracket being added when js is appended to jsonResults. Is there a property to be set on js that would prevent this?
Thanks,
Thys
In a webservice method, I want to append a JSON object to the JSON response. But the resultant object is not properly formatted.
Here is the code where the JSON object is added to the response:
st.SetValue (result)
js.Start ()
js.Load (st)
jsonResults.Append (js)
Here is the JSON that is returned:
{
"utQuery_response":
{
{
"list":[{"ClientNo":453,"Name":"Mondi"},{"ClientNo":732,"Name":"Meyersdal Shopping Centre"}]
}
}
}
The problem seems to be the extra pair of curly bracket being added when js is appended to jsonResults. Is there a property to be set on js that would prevent this?
Thanks,
Thys
27
Web Server - Ask For Help / Web services and Page Load
« on: May 23, 2018, 01:46:06 AM »
Hi,
I know that the Clarion templates implement a page-loading strategy whereby only portions of a table's records are loaded - and the list box allows the user to seamlessly scroll up and down without knowing that there are constant calls in the back to load the next page of data.
Are there any suggestions available how to approach this same strategy with web services? I have done some work already, but it seems clumsy and would like to consider other options.
Thanks
Thys
I know that the Clarion templates implement a page-loading strategy whereby only portions of a table's records are loaded - and the list box allows the user to seamlessly scroll up and down without knowing that there are constant calls in the back to load the next page of data.
Are there any suggestions available how to approach this same strategy with web services? I have done some work already, but it seems clumsy and would like to consider other options.
Thanks
Thys
28
Web Server - Ask For Help / NetWebServiceMethod - error on delete doesn't give correct errorcode
« on: May 20, 2018, 10:48:17 PM »
Hi,
Below is a portion of code in the DeleteRecord routine. You will notice that the first call p_web.AddServiceError uses ERRORCODE and ERROR to indicate the reason of the delete error. But it seems as if the errorcode has been reset before this call, resulting in errorcode 0 to be returned here ("ERRORDESCRIPTION": "Error occured Deleting the record 0").
So it's important to catch the error before other calls are made. Also, if an error occurs using SQL then ERRORCODE only returns 90 (FileSystemError) which doesn't say much about the real error. You should use FILEERRORCODE to get the real reason. This type of statement helps a lot to get the correct description:
choose (errorcode () = 90, fileerror (), error ())
Thanks,
Thys
do QueueToFile:RequiredAttribute
If p_web.GetFile(RequiredAttribute,REQ:RequiredAttribute_PK) = 0
idString = 'REQ:GUID = ' & REQ:GUID
If p_web.sqlsync then p_web.SqlWait(p_web.SqlName).
err = p_web.DeleteFile(RequiredAttribute)
If p_web.sqlsync then p_web.SqlRelease(p_web.SqlName).
if Err = 0
p_web.AddServiceResult('Delete','RequiredAttribute',idString,'success')
Else
p_web.AddServiceError(Err,'dbRequiredAttribute', p_web.RecordIdentifier(RequiredAttribute), 'Error occured Deleting the record ' & errorcode() & ' '& error(), '')
End
Else
p_web.AddServiceError(Error:RecordNotFound,'dbRequiredAttribute', p_web.RecordIdentifier(RequiredAttribute), 'Record not found when attempting to do a Delete', '')
End
Below is a portion of code in the DeleteRecord routine. You will notice that the first call p_web.AddServiceError uses ERRORCODE and ERROR to indicate the reason of the delete error. But it seems as if the errorcode has been reset before this call, resulting in errorcode 0 to be returned here ("ERRORDESCRIPTION": "Error occured Deleting the record 0").
So it's important to catch the error before other calls are made. Also, if an error occurs using SQL then ERRORCODE only returns 90 (FileSystemError) which doesn't say much about the real error. You should use FILEERRORCODE to get the real reason. This type of statement helps a lot to get the correct description:
choose (errorcode () = 90, fileerror (), error ())
Thanks,
Thys
do QueueToFile:RequiredAttribute
If p_web.GetFile(RequiredAttribute,REQ:RequiredAttribute_PK) = 0
idString = 'REQ:GUID = ' & REQ:GUID
If p_web.sqlsync then p_web.SqlWait(p_web.SqlName).
err = p_web.DeleteFile(RequiredAttribute)
If p_web.sqlsync then p_web.SqlRelease(p_web.SqlName).
if Err = 0
p_web.AddServiceResult('Delete','RequiredAttribute',idString,'success')
Else
p_web.AddServiceError(Err,'dbRequiredAttribute', p_web.RecordIdentifier(RequiredAttribute), 'Error occured Deleting the record ' & errorcode() & ' '& error(), '')
End
Else
p_web.AddServiceError(Error:RecordNotFound,'dbRequiredAttribute', p_web.RecordIdentifier(RequiredAttribute), 'Record not found when attempting to do a Delete', '')
End
29
Web Server - Ask For Help / NetWebServiceMethod - PROP:SQLFilter
« on: May 15, 2018, 09:49:47 PM »
Hi,
I have problem to get the sort order correct of a response view (SQL) whenever the SQL filter is set.
I have a clause in the "Order By" field, typically a name column. When the "SQL Filter" value is empty, the response is sorted correctly. But when I add an SQL filter clause, the ordering in the response returns to the default order and not that which is in the "Order By" field. I can't do without the SQL Filter value because Clarion syntax does not address NULL values properly.
These two have seemingly nothing in common - filtering should not affect ordering. But I've found that it does. As there a solution to this please?
Thys
I have problem to get the sort order correct of a response view (SQL) whenever the SQL filter is set.
I have a clause in the "Order By" field, typically a name column. When the "SQL Filter" value is empty, the response is sorted correctly. But when I add an SQL filter clause, the ordering in the response returns to the default order and not that which is in the "Order By" field. I can't do without the SQL Filter value because Clarion syntax does not address NULL values properly.
These two have seemingly nothing in common - filtering should not affect ordering. But I've found that it does. As there a solution to this please?
Thys
30
Web Server - Ask For Help / NetWebService - what is p_web.MaybeRemoveDeletedRecords ?
« on: April 17, 2018, 01:33:46 AM »
Hi,
I've just installed NT 10.19 and now the filters on the response from a VIEW don't work correctly. This the generated SQL sent to the database.
SELECT A.GUID, ... FROM dbo.Session A WHERE ( A.GUID = '27RVOKQMGTQ52RRY' AND A.DTS = 0 ) ORDER BY A.TS
I can see the portion in the WHERE clause that comes from my own code (A.GUID = '27RVOKQMGTQ52RRY'). It's clear though that the second expression in the WHERE clause is the reason why no records are returned (A.DTS = 0). This extra clause is probably generated by the template, that results in the following line:
p_web.MaybeRemoveDeletedRecords(loc:Filter,'SES:dts')
I think I understand why this is added, but to test for 0 instead of NULL in SQL is incorrect. The DTS value in SQL for a new record is NULL and not zero.
How can I alter the result from MaybeRemoveDeletedRecords to test for NULL?
Thys
I've just installed NT 10.19 and now the filters on the response from a VIEW don't work correctly. This the generated SQL sent to the database.
SELECT A.GUID, ... FROM dbo.Session A WHERE ( A.GUID = '27RVOKQMGTQ52RRY' AND A.DTS = 0 ) ORDER BY A.TS
I can see the portion in the WHERE clause that comes from my own code (A.GUID = '27RVOKQMGTQ52RRY'). It's clear though that the second expression in the WHERE clause is the reason why no records are returned (A.DTS = 0). This extra clause is probably generated by the template, that results in the following line:
p_web.MaybeRemoveDeletedRecords(loc:Filter,'SES:dts')
I think I understand why this is added, but to test for 0 instead of NULL in SQL is incorrect. The DTS value in SQL for a new record is NULL and not zero.
How can I alter the result from MaybeRemoveDeletedRecords to test for NULL?
Thys