I think I've figured out my interop problems, but I'd like some
confirmation that I'm not going down the wrong path.
I'm connecting to a web service over which I have no control, and it's
written in Java. My client is written in C#. Several of the WSDLs
use nil char, nil dateTime, nil decimal (that is, they all use
'nillable', they do not use occurs=0) for many of the response
variables. Therefore, I have to do something in my proxy class to
handle nil values, otherwise the XML deserializer chokes on the
'nil="true"' values that come back for such types.
It seems that I can modify the proxy class in one of these ways (or a
combo), depending on how I need to use the proxy class:
1. Change all the types in the proxy class for the corresponding XML
variables to "string," and handle any conversion appropriately after I
get the response back. That would mean, for example, that a variable
declared as Decimal in the proxy class would be changed (by hand) to
string, and then, when I wanted to use the variable, I would do
something like:
if ((null != ProxyObj.proxyVar) && ("" != ProxyObj.proxyVar))
System.Datetime myDateTimeOustideProxyClass =
Convert.ToDatetime(ProxyObj.proxyVar);
else
System.Datetime myDateTimeOustideProxyClass = Datetime.MinVal;
2. Use the technique described in:
http://blogs.msdn.com/smguest/archiv...07/128113.aspx
This article suggests creating a new class that shadows the value
types that cannot be nilable. Sort of a proxy class for the value
types in the proxy class.
My two questions:
1. Am I pointed anywhere near the right direction?
2. Is there an easier workaround for this?
3. Any ideas on automating (or at least easing the burden of)
manually modifying the proxy class whenever I generate a new one (or
refresh an existing one)?
Thanks.
Michael