We have a new .NET client that is calling methods on a Delphi server over the Remoting SDK. When using the /bin endpoint, our client deserializes responses correctly. However if we use the /json endpoint, the properties in the response are populated with null values. The following client code was generated automatically using the extension for Visual Studio 2022:
ResultLogin is a ComplexType, and is correctly populated when using the /bin endpoint. However all the properties are null when using the /json endpoint. I’ve used Wireshark to observe that the JSON response is being received by the client, and it appears to match well with the serializable classes.
Before I embark on a potentially painful process to create small client/server test apps (I don’t currently have Delphi), is there anything I should try, or anything you can think of that may shed some like one why I’m seeing this?
I’m using RemObjects.SDK 10.0.0.1549 on the client, and I’d have to get back to you with what version is running on the server (though it should be reasonably up-to-date).
we have fixed some issues with JSON deserialization in .1553 in .NET code.
it was related to datetime, boolean and number values.
if you are used these types in your ResultLogin struct, better to use .1553
this will be compatible with .1549 Delphi server.
It is better to have a simple testcase that reproduced your issue.
it will be difficult to reproduce this issue w/o your testcase.
With regard to trying a Delphi client; I now have a MyLibrary.remoteRODL that contains a ServerUri ending in /json. The ServerAccess TDataModule generated from this contained a TROBinMessage, which didn’t seem to work very well against the JSON endpoint (it did work against the /bin endpoint). I replaced this with a TROJSONMessage, and I can now see the JSON response coming back from the server in Wireshark, but again, even in the Delphi client, the response properties are not populated (contains nils).
Was manually replacing TROBinMessage with a TROJSONMessage the correct thing to do to the client code against a JSON server, and are there any other steps I may have missed that would result in the nils?
Ok thank you. It wasn’t obvious to me that the IMessage exposed in the C# client ServerAccess code was in fact the JsonMessage you were referring to. I have added the following to the ServerAccess constructor and it seems to work ok.
if (_message is not null && _message is JsonMessage)
((JsonMessage)_message).WrapResult = true;
I’m happy with this resolution, but please let me know if there is a better way to do this!
Thank you for your support