Unfortunately, the WS-I profiles don't cover type mapping issues.

XML Schema does allow you to specify that an element can contain a null
value (nillable="true") -- but elements aren't the same as value types.
Schema has no sense of value types. 

The true beauty of the Web services framework is that it only defines
wire-level protocols and XML Schemas. It doesn't define how applications
interact with the wire protocols or how they process the XML. It's the
responsibility of the language communities (e.g., the JCP) to develop the
standards that tie languages to XML. 

It's a bug in .NET that wsdl.exe maps your nillable type definition to an
int. It should map it to an object instead.

I found this discussion about .NET int (System.Int32) and SqlInt32.
http://www.dotnet247.com/247reference/msgs/8/41369.aspx 

It doesn't provide an answer, though. I suggest you provide a TypeDataSet
object for your .NET clients.

Anne

-----Original Message-----
From: Oliver Wulff [mailto:[EMAIL PROTECTED] 
Sent: Saturday, May 08, 2004 4:54 AM
To: [EMAIL PROTECTED]
Subject: Antwort: RE: Dot-Net's "wsdl.exe" and Non-Nullable Value Types





Hi Erik

I do have a similar problem. We're discussing whether it is necessary to
distinguish between a null or an empty (or default) value.

I don't know whether XML schema allows to say that a value type can be
marked as nillable. I'm not sure - maybe it does.
An integer is also a value type in Java but Java provides a holder class
which wraps this value type.

Maybe you can find some information about this in the basic profil 1.0
specification at http://www.ws-i.org because it's a real interoperability
issue.

Oliver



 

                      "Rick Kellogg"

                      <[EMAIL PROTECTED]        An:
<[EMAIL PROTECTED]>

                      t.net>                   Kopie:

                                               Thema:    RE: Dot-Net's
"wsdl.exe" and Non-Nullable Value Types                         
                      08.05.2004 06:32

                      Bitte antworten

                      an axis-user

 

 







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, NJ07722
732-936-0573
http://members.aol.com/ErikKlein




Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs








******************* BITTE BEACHTEN *******************
Diese Nachricht (wie auch allfällige Anhänge dazu) beinhaltet
möglicherweise vertrauliche oder gesetzlich geschützte Daten oder
Informationen. Zum Empfang derselben ist (sind) ausschliesslich die
genannte(n) Person(en) bestimmt. Falls Sie diese Nachricht
irrtümlicherweise erreicht hat, sind Sie höflich gebeten, diese unter
Ausschluss jeder Reproduktion zu zerstören und die absendende Person
umgehend zu benachrichtigen. Vielen Dank für Ihre Hilfe.


Reply via email to