problem with nested objects being passed from WEB Core client to XData

I have an object I'm sending from WEB Core to my XData service. It has a bunch of data fields, and one is an object that contains 8 strings. On the WEB Core side that's calling the interface, I added a test

if Assigned(obj_field) then ...

and it comes back TRUE. But on the XData side that receives the object, it's FALSE. The other data fields come across fine.

Debugging this code is a bit challenging, as all I get from the server is a non-specific 500 error return without looking for specific error conditions and throwing an appropriate exception. Assert doesn't even return anything specific. I had to insert a bunch of Logger statements to see what was happening on both sides. It didn't occur to me that the object wasn't being passed at all, so it took a while to track down.

I'm not sure if I'm doing something wrong or not, but it appears that the field containing the object is not getting serialized in the transfer to the service, so the resulting object's reference is NIL. (Sorry, I'm not quite sure how to see the serialized JSON that's being sent to the server.)

I seem to recall this topic of nested objects is discussed in the doc somewhere, but I'm having trouble finding it. Are nested objects supported? If so, is it possible there's a problem if you're using WEB Core as the client?

What can I do to dig into this further?

The obvious workaround is to replace the nested object by pulling the string fields out of the nested class and just put them into the outer class.

But the question remains: is this a known limitation, or a likely bug in the interface?

Yes.

Open the browser developer tools, go to the "Network" tab and there you will see all there requests being sent by the browser, their request headers, request body and also response data. It's your friend for any troubleshooting and debugging you have with your web applications.

So, everything should work fine. Please provide more info for both your client and server code, the data being sent in the request, and then we can try to help you find the issue.

2 Likes