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 - Thys

Pages: 1 2 [3] 4 5 ... 8
31
Hi,

I want to limit the number of records returned by a web service method. There is normally a VIEW that is used to return records in the .APPEND method, but I can't find a way in Clarion to limit the number of records returned, and the .APPEND method doesn't offer options to limit the number of records returned.

Is there an existing way to limit the number of records in a VIEW (something like SELECT TOP 10 * ...) or by the NetWebService template?

Thys

32
Hi,

In the BuildResultFields routine, the JSONClass.append method is used to read data from a structure into the JSON object. When the structure is a table or view, there is no way however to detect whether errors occurred when loading the data with the .append method.

Is there something in JSONClass available to detect that the .append method had errors? If so, can the template be changed to accomodate for errors please?

Thanks
Thys

33
Web Server - Ask For Help / NetWebServiceMethod - RemovePrefix
« on: March 26, 2018, 12:34:54 AM »
Hi,

I have a couple of NetWebServiceMethod procedures where the table prefixes are not removed in the resultant JSON, but the settings are correct. This is a sample of the code that the template generates in the BuildResultFields routine:

        ...
        jsonResults.RemovePrefix = true
        jsonResults.TagCase = jf:CaseAsIs
        jsonResults.CascadeDown()
        jsonResults.ExportBlobsWithView = true
        ...


I thought that the labels in the dictionary would be a possible cause that the prefixes are in the response, but (see attached file) there is nothing strange about the table definition. Below is an example of the response:

{
    "dbStaff_response": {
        "queue": [
            {
                "STFF:USERID": "AB",
                "STFF:INITIALS": "AB",
                "STFF:SURNAME": "Botha",
                "STFF:NAME": "Andrea",
                "STFF:TELNOWORK": "12650",
                "STFF:TELNOHOME": "(010)430 7873",
                "STFF:TELNOCELL": "089 577-2539",
                "STFF:ADDTELCONTACT": "(010) 312-6458",
                "STFF:PARENTUSERID": "",
                "STFF:EMAIL": "m@m.com",
                "STFF:ALTERNATIVEID": ""
            }
        ]
    }
}


Any ideas on how to fix it, without overriding each column's label?
Thys

34
Web Server - Ask For Help / NetWebServiceMethod - SQL Filter
« on: March 15, 2018, 03:01:58 AM »
Hi,

I see that the PROP:SQLFilter generated when an SQL filter value is provided in the response of a method, always adds '+' in front to concatenate the SQL filter to the values previously set in PROP:Filter.

If I don't want this behaviour, and have the SQL filter as the only expression, I'll have to change the template (or use OMIT over a large block of code). Is there another way to get rid of the '+' character?

Thys

35
Web Server - Ask For Help / Where to find NT class reference documents
« on: March 07, 2018, 04:46:23 AM »
Hi,

I've looked around on both the installed docs and the online docs, but I can't seem to find the class reference documents for NetTalk classes - especially for the NetWebServerWorker class. Are they still available?

Thys

36
Hi,

Below is an extract from the InsertRecord:Event routine that inserts a record to the EVENT table. I notice that the AddServiceErrorResult calls use ERRORCODE and ERROR to display the nature of errors, but in Clarion the values returned are adjusted whenever subsequent Clarion statements are called before it evaluates the original error.

In particular, look at the statement

err = p_web.AddFile(Event)

Where it is actually being reported on (7 lines lower), it uses the ERRORCODE and ERROR functions to report the nature of the error, but these values have both been reset to zero and blank - possibly because of a subsequent call to p_web.SqlRelease.

The only assumption that I have of the nature of the error, is to use the Err variable - that (I hope) corresponds to what the ERRORCODE () function would return. Please confirm whether this reasoning is correct.

     Clear(EVN:Record)
     do QueueToFile:Event
     TableAction = 'insert'
     do PrimeFields:Event
     Do ValidateRecord:Event
   If err = 0
       Get(Event,0) ! Prime duplicate checking for Insert
       errString = p_web.CheckForDuplicates(Event)
       if ErrString
            p_web.AddServiceError(DupKeyErr,'dbEvent', p_web.RecordIdentifier(Event), clip(ErrString),'')
       Else
            If p_web.sqlsync then p_web.SqlWait(p_web.SqlName).
            err = p_web.AddFile(Event)
            If p_web.sqlsync then p_web.SqlRelease(p_web.SqlName).
            if Err = 0
              if Event_Action <> 'sync'
                   p_web.AddServiceResult(Event_Action,'Event',p_web.RecordIdentifier(Event),'success')
              end
            Else
              p_web.AddServiceError(Err,'dbEvent',p_web.RecordIdentifier(Event), 'Error when attempting to Insert a record [' & errorcode() &'] ' & error(), '')
            End
       End
     Else
      p_web.AddServiceError(Err,'dbEvent',p_web.RecordIdentifier(Event), 'Error when attempting to Insert a record [' & errorcode() &'] ' & error(), '')
   End


Thys

37
Hi,

I have a web service method that needs to return plain text instead of JSON or XML. There must be a simple way, any help please?

Thys

38
Hi,

Is there anyone that has replaced the ABC FileManager class with NetTalk calls to web services? It will be a welcome alternative, to always have a services layer for any application.

Thys

39
Web Server - Ask For Help / NetWebServiceMethod - caching
« on: November 07, 2017, 01:42:25 AM »
Hi,

I've been experiencing "problems" where I use the WinHttp OLE control in a Clarion program to call a webservice method done in NetTalk. When the same HTTP request is made repeatedly with exactly the same values, the actual request never arrives at the service - but it returns a previous response value. So it looks like the client control caches the request and response, probably to save time.

I can't do much about the WinHttp OLE control in my Clarion app - there is no option to cache or not to cache. But it seems like the magic comes from the service. There seems to be two ways to instruct the client not to cache. If anyone can respond please, I want to confirm that my thinking is correct please.

The first is to set this in the WebServer procedure's "Override Default Server Settings", which instructs all connections not to cache responses.

    s_web.HeaderDetails.CacheControl = net:DontCache

The second is per NetWebServerWorker procedure, to set this value in the "ServiceMethod" routine.

    p_web.ForceNoCache = 1

Is this the correct way to disable caching on the client?
Thys


40
Hi,

When returning a VIEW parameter in a web method on a TPS file, there is no way to override the sort order in which data is returned. In fact, even the default of the PK is not used for the results. I looked at both the JSON and XML portions in the code, there is a PROP:ORDER set to the PK column, but the results are not correct. Is there another way to specify the required order?

Thys

41
Hi,

I want to make sure that Chrome is happy with the response from my web service. I previously understood that the default value

s_web._SitesQueue.Defaults.AccessControlAllowOrigin

needs to be set in the WebServer procedure to either * which Chrome doesn't accept any more, or to the correct domain. This will be sent back as part of the response header for any call. But now Chrome is not happy with just that anymore. It also wants the header Access-Control-Allow-Credentials to be set to true.

Which brings me to the question of how do I add a custom header to a response?

Thys

42
Hi,

I would like a method to return a combination of records that when combined serve a business purpose. It's like returning the content of a Clarion view in the response. The only indication in the documentation is to have two or more queue output parameters, which doesn't make it easy for the client app to consume. The documentation goes further to explain that it may be possible to have queue pointers within a queue - but that the explanation of how to do this might be too complex to understand, given that you need to use NEW and DISPOSE to manage memory. But I went the full way in doing this, but the response doesn't show the objects related to the queue pointers, only values. So this method doesn't seem to work although the documentation alludes to that it may be possible.

Is there any other way to have a complex response objects in a method, other than "flattening" it out to multiple output parameters?

Thys

43
Web Server - Ask For Help / JSON problem in webservice method
« on: August 28, 2017, 05:33:32 AM »
Hi,

I've been struggling with a web service method when inserting a record - it keeps on saying the record field values are blank. I've traced it down to (what I think) a problem on how the JSON class parses a string.

Attached is a small example app, showing that the JSON string contains a valid object, but when parsed it only has blank values. The code in the app is mostly copied from the generated template code, that is found in the PrimeParameters routine.

Can this be a problem in the JSON class, or do I have to change settings in the web service method? I'm using jFiles version 1.48.

Thanks
Thys

44
Hi,

This might not be the standard way to do it, but in some cases I want to add child table updates to the parent update method. For example when a Person record is updated, I also want to update Next of Kin records against the person.

How should one do this, or are there examples available to do it?

Thanks
Thys

45
Hi,

Attached is an app that runs on SQL. It has a table Log for which I've added a maintenance web method dbLog. Without this procedure, the app compiles without a problem. But it seems like the date/time group in the record causes the template to generate wrong code in the new procedure. Any suggestions please?

Thanks
Thys

Pages: 1 2 [3] 4 5 ... 8