go to post David Crawford · Feb 20, 2018 I'm just trying to send a large chunk of characters, have it stored as a stream, and then returned to the client. Thank you for your advice though, I'll figure something out hopefully, at least I know what can be done.
go to post David Crawford · Feb 20, 2018 What if I need to read something that is beyond the max string length? Do I have to break it up into segments?
go to post David Crawford · Feb 20, 2018 Aha you're absolutely right. It was so simple, thank you! SizeGet() was accurate and I overrode the Read() default.
go to post David Crawford · Feb 15, 2018 Fantastic! This is perfect, thank you so much!From your example, at a minimum I had to add two parameters to my ajax:contentType: "application/json",dataType: "json",And then to retrieve them, the REST service simply needs this to send back to the client whatever was in the message:set jsonstring = $ZCONVERT(%request.Content.Read(),"I","UTF8")set data = {}.%FromJSON(jsonstring)write data.%ToJSON()Thanks again!David
go to post David Crawford · Feb 15, 2018 The message gets sent and a reply comes through successfully, but the body information still isn't seen by the rest service.
go to post David Crawford · Feb 15, 2018 Yes, this is the whole call, with the intention of receiving whatever I sent back to me:$.ajax({ headers: { "Authorization": "Basic " + btoa("username:password") }, url:"serverurl/returnresponse", type: "POST", data: { "payload": "some data" }, success: function (response) { console.log(response); }}); Then the route:<Route Url="/returnresponse" Method="POST" Call="ReturnResponse" Cors="false"/> The method:ClassMethod ReturnResponse() as %Status { try { set obj = %request.Data //...Contents...etc. write obj } catch ex { write ex.Name } return $$$OK}
go to post David Crawford · Jan 16, 2018 Hello, From what you've provided, this looks like a javascript error simply indicating that the function it's looking for doesn't exist. How are you calling cspHttpServerMethod? In the section Calling Server-side Methods Using #server on this documentation chapter, the proper javascript syntax is given to call server-side methods. For example from the doc, function test(value) { // invoke server-side method Test #server(MyPackage.Test(value))#; }