Please see the following for
recommendations:
Interoperability Notes on Apache Axis
1.1 and [Microsoft
.NET Framework] 1.0/1.1 FAQ
http://nagoya.apache.org/wiki/apachewiki.cgi?AxisProjectPages/DotNetInterop
From: Erik Klein
[mailto:[EMAIL PROTECTED]
Sent: Friday, May 07, 2004 12:54
PM
To: [EMAIL PROTECTED]
Subject: Dot-Net's
"wsdl.exe" and Non-Nullable Value Types
I have
built a webservice using Apache Axis 1.1 that is implemented as RPC / Encoded
for no reason other than the fact that I have Custom Exceptions thrown from my
Interface and Java2WSDL does not like this. I also attempted to use Axis
1.2 Beta to resolve this problem but ran into additional problems with
BeanMappings that I did not understand.
I am attempting to use Dot-Nets wsdl.exe to generate a Web Service Client
in C# from a valid WSDL file generated by Apache Axis.
My application requires the ability to distinguish between an unspecified value
and a specified value. For that reason, the WSDL that is generated by
Apache Axis utilizes 'nillable="true"' to permit Web Services Clients
to indicate a value or specify 'nil'.
Here is a portion of the WSDL presenting a problem:
<complexType abstract="true" name="Type">
<sequence>
<element name="localId"
nillable="true" type="xsd:string"/>
<element name="id" minOccurs="0"
maxOccurs="1" nillable="true" type="xsd:int"/>
</sequence>
</complexType>
When wsdl.exe generates its class from this, it creates the following:
public abstract class Type {
public string localId;
public int id;
}
The problem is that the "int" is a Value Type that is incapable of
storing null. I have tried the following all to no avail:
1. Replacing 'type="xsd:int"' with 'type="soapenc:int' (which
made Java WSDP work)
2. Including/Removing 'minOccurs' and/or 'maxOccurs'
3. Manually replacing 'public int id' with 'public SqlInt id' (SqlInt is not
the correct name, but its the one from the Dot-Net SQL namespace that is used
to support nulls for ints in the DB ... .NET barked at me when I attempted to
use this telling me it can't be used for XML serialization or some such thing).
I am out of ideas and wondering if you can guide me to a way to AVOID having
.NET pass a zero(0) when this attribute is not specified (which is what it
currently does for Value Types). I was hoping to find the equivalent of
java.lang.Integer (which can be null) in C# but have had no success.
One last note: This WSDL will be consumed by clients who purchase the software
I am developing. They will be responsible for generating their own Web
Service Clients using the toolkit of their choice, so I am trying to make it as
standardized as possible while requiring minimum client intervention/recoding
when they generate the Web Service client.
Thanks in advance for any suggestions.
Erik
p.s. I
got no replies to the newsgroup posting I put on microsoft.public.dotnet.framework.webservices
Erik Klein
Versatile Consulting Inc.
621 Lovett Road
Colts Neck, NJ 07722
732-936-0573
http://members.aol.com/ErikKlein
Do you Yahoo!?
Win
a $20,000 Career Makeover at Yahoo! HotJobs