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 6 ... 8
46
Hi,

I have a method dbAddress for normal CRUD functionality. When I do an insert (POST with content application/json in the body) for multiple records, it works fine.

But I want to pass extra values to the method as well. It only works when the values are passed in the URL, which I don't want to. When it's added to the header, it doesn't receive the value. The only option is to add it to the JSON in the body, but I can't seem to get the formatting right - can extra values be added via the JSON in the body?

The JSON in the body looks like this:

{"Address":[
   {
      "guid":"",
      "description":"First address",
      "physicaladdress":"1 Short Street, Centurion",
      "postaladdress":"P.O.Box 1234, Centurion"
   },
   {
      "guid":"",
      "description":"Second address",
      "physicaladdress":"2  Long Street, Centurion",
      "postaladdress":"P.O.Box 7, Centurion"
   }
   ]
}


Thanks
Thys

47
Hi,

I would like to add multiple records with one call. This is to ensure that a transaction frame can handle a single commit or rollback for all records. In the web method the payload is received in JSON (see attached) in the body with content type set to application/json. The parameter queue has a structure like below, with the parameter setup as in the second attachment.

When called, the parameter queue doesn't get populated. Should the JSON structure be changed?

AttributeValues QUEUE,PRE(AVQ)
AttributeValueNo  DECIMAL(19,0)
AttributeCode     CSTRING(11)
RequiredNo        LONG
ContextObjectNo   LONG
ContextInstanceRefNo CSTRING(101)
TargetObjectNo    LONG
TargetInstanceRefNo CSTRING(101)
Value             CSTRING(1001)
                END


Thanks
Thys

48
Hi,

I get a Clarion error message when inserting a child record in MSSQL, where a trigger on the child table checks whether a parent record exists (special conditions, so normal FK constraint can't work). When the auto numbering in Clarion is done and the record is added, the trigger returns the error - but this is not passed back to the Clarion code to report the error to the web service method. See attached.

The app is set to Release, so I didn't expect the error to be displayed. Any suggestions on how to deal with it?

Thanks
Thys

49
Web Server - Ask For Help / JSON to XML and vice versa
« on: May 04, 2017, 03:36:06 AM »
Hi,

Just wondering if there is an easy way to convert from JSON to XML and vice versa? Should probably be methods within jfiles and xfiles.

Thys

50
Hi,

I have a string variable as a return value in a web service method that returns JSON. Under certain conditions I would like this value not to contain string quotes around it in the JSON result. I see that in the generated code when I change

jsonResults.append('content',p_web.AsciiToUtf(REG:content),json:String)

to

jsonResults.append('content',p_web.AsciiToUtf(REG:content),json:Literal)

the string quotes are not added. How can this be done without changing the generated code?

Thanks

51
Web Server - Ask For Help / WS - File downloads, but is corrupted
« on: February 08, 2017, 11:39:06 PM »
Hi,

This is one of those cases where "it was working before, but something happened". In a file download method the file does download, but it is corrupted. The downloaded size is just a couple of bytes more than the original one. Not sure why? Here is the ServiceMethod code.

if ReturnFile.LoadFile (clip (p_web.site.UploadsPath) & '\' & clip (DocumentID)) <> 0 then
   ReturnFile.Base64Encode ()
   if FileName = '' then FileName = clip (DocumentID).
   p_web.HeaderDetails.ContentDisposition = 'attachment; filename="' & FileName & '"'
   p_web.ReplyContentType = 'application/' & ReturnFile.ExtensionOnly ()
else
   p_web.ServiceErrorQueue.ErrorNumber = 1
   p_web.ServiceErrorQueue.ErrorPosition = 'DownloadFile'
   p_web.ServiceErrorQueue.ErrorRecordId = 'DocumentID'
   p_web.ServiceErrorQueue.ErrorDescription = 'Requested file not found'
   add (p_web.ServiceErrorQueue)
end


Thys

52
Web Server - Ask For Help / Access-Control-Allow-Origin
« on: February 06, 2017, 07:14:11 AM »
Hi,

I'm using a page script in Firefox to do a file upload to a NT web service method. The file is successfully uploaded, but the browser's console then returns an error:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://127.0.0.1:8080/UploadFile?FileExtension=PDF. (Reason: CORS header 'Access-Control-Allow-Origin' missing).

Because the file is successfully uploaded, the only reason I can think of for this error, is that the response might be missing information. I started reading about Access-Control-Allow-Origin, which is a response header used for cross-origin HTTP requests. Is there something in the NT web service that I can change to get this working?

Thys

53
Web Server - Ask For Help / Base64 file encoding on client
« on: February 02, 2017, 10:13:11 PM »
Hi,

I've managed to do a file upload to a NT web service using client-side JavaScript, for which I'm very thankful - it solves a huge problem for us.

But now with a Clarion client doing the file upload, I don't know how to base64 encode the file content before it is uploaded. In the server side's ServiceMethod routine, I use the following code:

   FileContent.Base64Decode ()
   FileContent.SaveFile (clip (p_web.site.UploadsPath) & '\' & DocumentID)

In the Clarion code, where I think the file must be encoded first, I use this code:

   nt.SetValue ('FileContent', GLO:FileName, true)
   nt.SetValue ('FileExtension', GLO:Extension)
   nt.Post (GLO:URL, '')

There is a method for nt.Base64Encode, but it takes a string as parameter - which supposedly is the file content to be encoded. If I introduce a StringTheory variable to do the encoding, how do I adjust the content provided by the SetValue statement for FileContent then before the POST is done?

Thanks
Thys

54
Hi,

We're experimenting with H5 Bootstrap. I know this is a NT forum, but hopefully I can use H5 and NT in the same solution.

The one feature that's lacking in H5 is the ability to do a file upload. With a NT web service that has a file upload method, I was hoping to look at a way to use a client-side script to POST the file to the NT web service before the H5 form is submitted.

I also know that the WinHTTP object should be available in the client script, that can be used to do the POST. But that's about where my current understanding stops. Any ideas?

Thys

55
Hi,

I would like to set up to web methods to do a file upload and file download. I have seen the example apps for file uploads/downloads, but I can't find sample code to do this from a webservice method. Any help maybe?

Thanks
Thys

56
Web Server - Ask For Help / Browse control passing parameter to form
« on: January 11, 2017, 05:48:35 AM »
Hi,

I have something that feels like a NT first grade question, but can't get the answer.

On a browse I need to add a parameter for the form control. Without calling the form as a popup, I can call it via a URL with parameters. But the URL can't be used when the form is called as a popup. So I have to resort to session variables. Is there may an alternative to session variables?

Thys

57
Hi,

We have a few browse controls on a large update form. On any of the browses on the large update form, when we open its own small update form as a popup, the browse buttons on the large update are disabled when the popup closes with either Save or Cancel. But when the small update form is not called as a popup it works fine.

Any ideas what to look for?

Thys


58
Web Server - Ask For Help / Repeated use of browse on a form
« on: December 21, 2016, 10:30:12 PM »
Hi,

I have a form on which a browse is repeatedly used i.e. the browse is generated using different filters. But the functionality to edit records on the browse doesn't seem to be consistent on all instances of the browse. On the first instance on the form, everything works fine. But on the second instance the selection of a record doesn't seem to work.

I suspect it's because the DIV of each of each browse has got the same id - which are template generated. It could be that JQuery can't distinguish between them.

Is there another way to uniquely identify each instance of the same browse on a form?

Thys

59
Web Server - Ask For Help / Search locator shows when not expected
« on: December 21, 2016, 01:07:58 AM »
Hi,

I have a browse that's used on a form more than once. I don't want the search locator to show anywhere on the form. It doesn't show for the first instance of the browse, but from there it starts showing - at least just the entry control. I've selected "No Locator" on the browse, but still shows.

I there maybe another way to totally remove the search locator?

Thys

60
Web Server - Ask For Help / Browse on a queue
« on: November 09, 2016, 04:35:28 AM »
Hi,

I saw a previous post asking for advice how to create a browse on a queue. The responses pointed to using a memory table and not a queue.

I have a similar request, but my queue is created from rows that SQL stored procs returns. So I can't put it in a memory table as there is no physical underlying table for it. The only way that I think it will work, is to create a temp table to populate the results into and then load it in the browse via a dct table. Because it's multi-user I'll have to be careful to have distinct temp table names. So I'll also have to give the dct table a variable name depending on the user. Seems complex for a simple task?

Is there any alternative to this available?

Thys

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