Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / March 2008

Tip: Looking for answers? Try searching our database.

Generated proxy WS methods require parameters optional in WSDL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mvexel - 18 Mar 2008 15:42 GMT
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
-------------------------------------
Tiago Halm - 19 Mar 2008 00:48 GMT
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

> Hi all,
>
[quoted text clipped - 52 lines]
> Disclaimer: www.geodan.nl/disclaimer
> -------------------------------------
mvexel - 20 Mar 2008 09:56 GMT
> 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
[quoted text clipped - 60 lines]
>
> - Tekst uit oorspronkelijk bericht weergeven -

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
-------------------------------------
Tiago Halm - 24 Mar 2008 20:54 GMT
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

On 19 mrt, 00:48, "Tiago Halm" <th...@nospam.hotmail.com> wrote:
> WCF proxy should be generating your bools with Nullable<bool> or bool?.
> Would be interesting to build a service accepting a Nullable<bool> as
[quoted text clipped - 66 lines]
>
> - Tekst uit oorspronkelijk bericht weergeven -

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
-------------------------------------
John Saunders [MVP] - 25 Mar 2008 03:42 GMT
> 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).

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.
Signature

--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer

Tiago Halm - 25 Mar 2008 19:15 GMT
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

>> Seems nillable is missing from System.Web.Services (ASMX, .NET 1.x). See
>> here:
[quoted text clipped - 6 lines]
> like. In VS2003, .NET 1.1. VS2005, .NET 2.0. In VS2008, .NET 2.0 through
> 3.5.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.