NetTalk Central

Author Topic: Problem with Netwebservice and file objects (Stringtheory)  (Read 3825 times)

Poul

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Problem with Netwebservice and file objects (Stringtheory)
« on: November 04, 2015, 12:12:25 PM »
Following example webinars on how to use a web-service to upload a file.
My client uses a simple POST. no Soap, no JSON.I kept GPFing the server, and have found two anomalies

in my  NetWebServiceMethod
I am using a 'File'  type parameter which is a local Stringtheory object called Incomingfile - just like webinar example.
it generates something like this
Code: [Select]
PrimeParameters  routine
 !clear all table record structures nice and early.
  IncomingFile = p_web.MethodParameter  ! REST default parameter. May be overridden lower down
  Case p_web.RequestMethodType
  of NetWebServer_GET
  of NetWebServer_POST
  of NetWebServer_PUT
  of NetWebServer_DELETE
  End

  If p_web.xml = 0 and p_web.json = 0 ! incoming parameters are just url encoded, either in the URL, or as post data, or as a cookie.
    IncomingFile.Free()
    If p_web.IfExistsValue('IncomingFile') then IncomingFile.SetValue(p_web.GetFileFromPost('IncomingFile')).
...

I GPF on  IncomingFile.Free() i believe because of
Code: [Select]
IncomingFile = p_web.MethodParameter  ! REST default parameter. May be overridden lower downcommenting this line allows the code to execute.

also if i tick the send parameters to debugview it generates a comple error.
Code: [Select]
  p_web.Trace('IncomingFile = ' & IncomingFile.Sub(1,100 & ' .....' )



Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Problem with Netwebservice and file objects (Stringtheory)
« Reply #1 on: November 05, 2015, 05:00:46 AM »
thanks for the report Poul.
fixed in 8.64, which is now up.

cheers
Bruce

Poul

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Re: Problem with Netwebservice and file objects (Stringtheory)
« Reply #2 on: November 12, 2015, 08:40:00 AM »
Thanks Bruce,
That appeared to Work, but i am seeing a strange generating problem after this update.
the first line in the Prime Parameters Routine

"Sometimes" Generates Correctly
Code: [Select]
   IncomingFile.SetValue(p_web.MethodParameter,st:clip)  ! REST default parameter. May be overridden lower down
then other times generates incorrectly:
 
Code: [Select]
  IncomingFile = p_web.MethodParameter  ! REST default parameter. May be overridden lower down
I am not touching the NetWebServiceMethod procedure itself, but I am touching a Procedure it calls (and it happens to be in the same module)
I have not discerned what exactly triggers the behaviour, as sometimes it works thru many regenerates, before it generates the wrong code.

if I simply touch the description in the actions for the Procedure in the IDE and then generate again it generates the correct code !? 
i am using C9.1