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.

What if I need to read something that is beyond the max string length? Do I have to break it up into segments?

Aha you're absolutely right. It was so simple, thank you! SizeGet() was accurate and I overrode the Read() default.

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!


The message gets sent and a reply comes through successfully, but the body information still isn't seen by the rest service.

Yes, this is the whole call, with the intention of receiving whatever I sent back to me:

                headers: { "Authorization": "Basic " + btoa("username:password") },
                type: "POST",
                data: {
                    "payload": "some data"
                success: function (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


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