We are creating some WCF services that will initially be consumed by .NET clients but in the future will be consumed to Java clients.
As such we want to avoid using any data types in the interface that Java does not support.
The specific one we know of is nullable value types.
One suggestion is that we can support these by using a string to represent, for example, a nullable int. And empty string therefore represents null, otherwise there is a requirement that the string must be parsable as an int.
Can anyone recommend a better alternative, or is this what you would do?
I'd hope that if you can expose a nullable integer through WCF, that anything consuming that from Java will use the wrapper types - Integer
instead of int
, Byte
instead of byte
etc. Of course these are reference types whereas nullable value types in .NET are still value types, so you'll get more GC pressure and it'll be generally less efficient, but there's not a lot you can do about that given that Java doesn't support user-defined value types.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With