I don't think your problem lies in serialization.
Setting JsConfig.IncludeNullValues = true
won't affect whether your request DTO transfers from client to server correctly. It affects the efficiency of the wire protocol. That configuration only affects the payload size of the serialized JSON.
Rather than sending {"name":null}
(13 UTF-8 bytes), serializing with JsConfig.IncludeNullValues = false
will send {}
(2 UTF-8 bytes).
But the deserialized DTO received by the server will be identical to the DTO on the client in both cases.
(Also, your example code is sending an empty string ""
not null
. So it will be completely unaffected by the JsConfig.IncludeNullValues
setting.)
I'm guessing your problem lies in the routing of your request DTO. There's probably something ambiguous about it (or it conflicts with other request DTOs) such that ServiceStack can't figure out how to route it to your PortfolioService
class.
Calling the service directly is bypassing all the ServiceStack routing logic.
Can you include the source for your GetPortfolio
request DTO class, so we can see if there is anything obviously wrong?