Kurro Lopez · Jan 26, 2017

SOAP.OutboundAdapter HttpResponse doesn't handle large response [SOLVED]

Hi all,

Sorry to bother frown

I have a Business Object with SOAP.OutboundAdapter and it gets the response from a WebApi.

Following the sample Creating REST Services and Clients with Ensemble - Developing a REST Operation, I've done the call and it retrieves a JSon with the information. The result is a JSon with a Base64 content (at least 15000 bytes)

I've put a trace to check the content  with $$$TRACE(tHttpResponse.Data.Read() I have a cut result (to 1200 character), so the JSonStreamToObject is not able to allocate the full result into a object.

is there any way to handle more character in HttpResponse or is about SOAP.OutboundAdapter configuration?

Best regards

0 481
Discussion (6)0
Log in or sign up to continue

Hi all,

I've found the "ghost in the code". The problem was the JSon structure has some fields with "_" as part of the name of the property. When it tries to convert JSon to a class, this kind of name is not good for ensemble.

How have I solved? easy... replacing the content and remove all "_" (I'm sure that there is not values with "_")

    set content = tHttpResponse.Data.Read()
    set content = $REPLACE(content,"_","") // Remove all _ as part of the field name
    set objJson = ##class(%DynamicObject).%FromJSON(content)

    set b64 = objJson.Result.RES.DATA.DATAB64   // Instead of DATA_B64

Take care with this problem if you are developing Api and Cache wink

Best regards

There should not be a problem with underscores:

set obj = ##class(%DynamicObject).%FromJSON("{""a_b"":1}")
w obj."a_b"

Thanks Eduard, my JSon has this underscore as part of the name of variable but is not supported (or it seems). With my workaround it works

mmm... I see

The name of the variable is under double quote, and I'm calling the variable directly. Let me check in my solution.

USER>set obj = ##class(%DynamicObject).%FromJSON("{""A_B"":""HELLO WORLD""}")
USER>w obj.A_B
W obj.A_B
USER>w obj."A_B"

Indeed underscore characters are fully supported in the new JSON API (%DynamicObject and %DynamicArray). Are you sure this is the only change you made?