all groups > dotnet web services > march 2008 >
You're in the

dotnet web services

group:

Generated proxy WS methods require parameters optional in WSDL


Generated proxy WS methods require parameters optional in WSDL mvexel
3/18/2008 7:42:07 AM
dotnet web services:
Hi all,

Consider the following snippet of WSDL:

<xsd:element name="findWellsInputMsg">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="language" type="dds:LanguageType" />
<xsd:element minOccurs="0" name="longitude"
type="dds:RangeType" />
<xsd:element minOccurs="0" name="latitude"
type="dds:RangeType" />
<xsd:element minOccurs="0" name="depth"
type="dds:RangeType" />
<xsd:element minOccurs="0" maxOccurs="1"
name="hasWaterLevels" type="xsd:boolean" />
<xsd:element minOccurs="0" maxOccurs="1"
name="hasWellTests" type="xsd:boolean" />
<xsd:element minOccurs="0" maxOccurs="1" name="hasLogs"
type="xsd:boolean" />
<xsd:element minOccurs="0" maxOccurs="1"
name="hasAnalysis" type="xsd:boolean" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>

As you see, all parameters are optional except "language".

I import the WSDL in my .NET 3 project through 'Add Service Reference.
I opt to include async operations. Otherwise I leave all options at
their defaults.

Now when I create a request for this operation, it will accept null
for the complex types 'longitude', 'latitude' and 'depth'. These will
then be omitted in the SOAP request generated. But because bools are
not nullable, I can't find a way to leave those out of the request. Is
this a bug in wsdl.exe or am I not seeing something here?

Thanks for your insights,

Martijn van Exel
Software Engineer
http://oegeo.wordpress.com/
-------------------------------------
Geodan S&R
President Kennedylaan 1
1079 MB Amsterdam (NL)
-------------------------------------
Tel: +31 (0)20 - 5711 318
Fax: +31 (0)20 - 5711 333
-------------------------------------
E-mail: martijn.van.exel@geodan.nl
Website: www.geodan.nl
KvK-nummer: 33 247475
Disclaimer: www.geodan.nl/disclaimer
Re: Generated proxy WS methods require parameters optional in WSDL Tiago Halm
3/18/2008 11:48:47 PM
WCF proxy should be generating your bools with Nullable<bool> or bool?.
Would be interesting to build a service accepting a Nullable<bool> as input
and compare the WSDL generated with this one.

Tiago Halm

[quoted text, click to view]

Re: Generated proxy WS methods require parameters optional in WSDL mvexel
3/20/2008 1:56:54 AM
[quoted text, click to view]

My colleague tried that. A service that accepts a bool? (nullable) as
input generates a WSDL node with minOccurs=3D"1", maxOccurs=3D"1" and
nillable=3D"true". So that's different from the WSDL we got from our
service provider, which just provided a boolean with minOccurs=3D"0"
maxOccurs=3D"1" and nillable not set.

Nu much of a surprise when the test service accepted null input for
the boolean just fine. Problem is, I can't control the WSDL I get as
it comes from an external provider. They implement their services in
Java (JaxWS), I guess I should be asking a JaxWS person why the WSDL
turns out like this.

Thanks so far!

Martijn

Martijn van Exel
Software Engineer
-------------------------------------
Geodan S&R
President Kennedylaan 1
1079 MB Amsterdam (NL)
-------------------------------------
Tel: +31 (0)20 - 5711 318
Fax: +31 (0)20 - 5711 333
-------------------------------------
E-mail: martijn.van.exel@geodan.nl
Website: www.geodan.nl
KvK-nummer: 33 247475
Disclaimer: www.geodan.nl/disclaimer
-------------------------------------
Re: Generated proxy WS methods require parameters optional in WSDL Tiago Halm
3/24/2008 8:46:24 PM
Seems nillable is missing from System.Web.Services (ASMX, .NET 1.x). See
here:
http://kjellsj.blogspot.com/2005/04/optional-numeric-fields-in-infopath.html

Have you tried to generate the proxy via "Add Web Reference"? This will make
use of .NET 1.x instead of .NET 2.0 (WCF).

Tiago Halm

[quoted text, click to view]

My colleague tried that. A service that accepts a bool? (nullable) as
input generates a WSDL node with minOccurs="1", maxOccurs="1" and
nillable="true". So that's different from the WSDL we got from our
service provider, which just provided a boolean with minOccurs="0"
maxOccurs="1" and nillable not set.

Nu much of a surprise when the test service accepted null input for
the boolean just fine. Problem is, I can't control the WSDL I get as
it comes from an external provider. They implement their services in
Java (JaxWS), I guess I should be asking a JaxWS person why the WSDL
turns out like this.

Thanks so far!

Martijn

Martijn van Exel
Software Engineer
-------------------------------------
Geodan S&R
President Kennedylaan 1
1079 MB Amsterdam (NL)
-------------------------------------
Tel: +31 (0)20 - 5711 318
Fax: +31 (0)20 - 5711 333
-------------------------------------
E-mail: martijn.van.exel@geodan.nl
Website: www.geodan.nl
KvK-nummer: 33 247475
Disclaimer: www.geodan.nl/disclaimer
-------------------------------------

Re: Generated proxy WS methods require parameters optional in WSDL John Saunders [MVP]
3/24/2008 10:42:56 PM
[quoted text, click to view]

Add Web Reference will use ASMX, but for whichever version of .NET you like.
In VS2003, .NET 1.1. VS2005, .NET 2.0. In VS2008, .NET 2.0 through 3.5.
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer

Re: Generated proxy WS methods require parameters optional in WSDL Tiago Halm
3/25/2008 6:15:28 PM
Yes, "Add Web Reference" will make use of System.Web.Services object model.
This object model is present in both CLR versions available (1.1 and 2.0).
Using VS2003 will make use of CLR 1.1 (and .NET 1.1). Using VS2005 (and
above, like VS2008) will make use of CLR 2.0 and the respective .NET version
(2.0, 3.0, 3.5).

However, at build time, you're free to use whatever CLR you choose, 1.1 or
2.0.

Tiago Halm

[quoted text, click to view]

AddThis Social Bookmark Button