472,956 Members | 2,219 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,956 software developers and data experts.

Boolean parameter maps to two separate parameters in proxy?

I have a wsdl file that I received from a third party and I'm using wsdl.exe
(.NET 2.0) to import it and generate a proxy class. I've actually got a
proxy class that works, but I'm trying to understand why wsdl.exe did what
it did and whether or not the complexity it's added to the interface is
necessary or avoidable.

The wsdl file specifies a Boolean parameter pAggregatePurses for one of the
web service methods. In the proxy class method that is represented by two
separate parameters:

<System.Xml.Serialization.XmlElementAttribute(IsNu llable:=true)> ByVal
pAggregatePurses As System.Nullable(Of Boolean)

and

<System.Xml.Serialization.XmlElementAttribute(IsNu llable:=true),
System.Xml.Serialization.XmlIgnoreAttribute()> ByVal
pAggregatePursesSpecified As Boolean

I can't see anything in the wsdl file that would result in this method
signature. Is this normal behavior for the wsdl.exe utility when dealing
with Boolean parameters? Is it necessary? Can anyone explain why it works
the way it does?

Thanks,
Zoe
Jun 22 '06 #1
10 2292
Hello Zoe,

I just test a simple web service with boolean parameters, but I didn't find
two separate parameters in the proxy class. So I think this should be
related to the WSDL file you got. Is it possible for you to provide the
WSDL file, to narrow down the problem?

Regards,

Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Jun 23 '06 #2
Luke,

The WSDL is not mine and may contain information proprietary to the web
service provider and or my client, the web service consumer. But I've been
taking another look at it and have a guess as to what's happening. Along
with the WSDL I get a set of XML and XSD files that provide supporting
definitions. One of the XSD files provides the definition of a type that
represents the full set of input parameters for the method I'm working with.
That type definition is for a complex type and the parameter in question is
one element of that complex type. The element definition with the XSD looks
like this:

<xsd:element name="someName" type="xsd:boolean" nillable="true"
minOccurs="0" />

I wonder if it's the combination of the type="xsd:boolean" and the
nillable="true" attributes. Since a boolean isn't normally nullable, you
need two pieces of information - 1) whether or not a value has been set and
2) the actual value which is only valid when the (1) is True. Even so the
type of System.Nullable(Of Boolean) seems to cover both pieces of
information within the elements of the System.Nullable type, so I'm still a
bit confused as to why the WSDL.exe tool generated a whole new, separate
parameter to indicate whether or not a value had been supplied.

Thanks,
Zoe

"Luke Zhang [MSFT]" <lu******@online.microsoft.com> wrote in message
news:2Y**************@TK2MSFTNGXA01.phx.gbl...
Hello Zoe,

I just test a simple web service with boolean parameters, but I didn't
find
two separate parameters in the proxy class. So I think this should be
related to the WSDL file you got. Is it possible for you to provide the
WSDL file, to narrow down the problem?

Regards,

Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 26 '06 #3
Hello,

The main difference between the sepeated parameters is:
System.Xml.Serialization.XmlIgnoreAttribute(), which indicate not to
serialize the parameter. I think this may be related to:

minOccurs="0"

How do you think about this?

Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Jun 27 '06 #4
Luke,

I could be wrong, but I don't think the minOccurs="0" is the problem. Here's
the definition of another parameter to the same method:

<xsd:element name="anotherParameter" type="outNamespace:someType"
nillable="true" minOccurs="0" />

This parameter is also nullable with minOccurs="0". The main difference
between this parameter and the one that generates two parameters is the
type. This one is an object type defined elsewhere in the XSD, while the
other is a Boolean. I think the wsdl utility generates the somewhat
complicated parameters it does for the nullable Boolean parameter because
the CLR doesn't allow a null value for a Boolean type. If you generate a
WSDL with a nullable (nillable="true") Boolean parameter, can you reproduce
what I'm seeing with the dual proxy parameters representing a single acutal
parameter?

Thanks,
Zoe

"Luke Zhang [MSFT]" <lu******@online.microsoft.com> wrote in message
news:ba**************@TK2MSFTNGXA01.phx.gbl...
Hello,

The main difference between the sepeated parameters is:
System.Xml.Serialization.XmlIgnoreAttribute(), which indicate not to
serialize the parameter. I think this may be related to:

minOccurs="0"

How do you think about this?

Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 27 '06 #5
Hi Zoe,

I create a test webservie with following web method:

<WebMethod()> _
Public Function GetString(ByVal b As System.Nullable(Of Boolean)) As
String
Return "Hello"
End Function

But WSDL.exe still only generated one function definition in the proxy
class. Can you share a sample of the web method?

BTW, I work with WSDL.exe in VS.NET 2005.

Thanks,

Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Jun 28 '06 #6
Unfortunately I don't have visibility into what the web service code looks
like - only what the resulting wsdl file looks like. I'll send you the wsdl
offline to see if you can see what in it is causing this overly complex
proxy class. I've recently run into another issue with a similar property.
In this case the proxy again uses two separate values to represent what is a
single value (this time a Long) in the wsdl. In this case it was an output
parameter not an input parameter and from what I've been able to tell in my
testing the "xyzSpecified" parameter generated by the proxy is not reliably
populated. xyzSpecified appears to be False even when the xyz output
parameter comes back with a value. I can code around all this but a) it's a
hassle and b) I'm concerned about the longterm reliability and
maintainability of code that's based on things like "xyzSpecified appears to
be False even when the xyz output parameter comes back with a value". It
feels like I'm coding around a bug instead of understanding and correcting
it and in my experience that is rarely a good idea.

Zoe

"Luke Zhang [MSFT]" <lu******@online.microsoft.com> wrote in message
news:Hb**************@TK2MSFTNGXA01.phx.gbl...
Hi Zoe,

I create a test webservie with following web method:

<WebMethod()> _
Public Function GetString(ByVal b As System.Nullable(Of Boolean)) As
String
Return "Hello"
End Function

But WSDL.exe still only generated one function definition in the proxy
class. Can you share a sample of the web method?

BTW, I work with WSDL.exe in VS.NET 2005.

Thanks,

Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 29 '06 #7
Hi Zoe,

I have receive your message. I will study the WSDL file and update you as
soon as possible.

Regards,

Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Jun 30 '06 #8
Hi Zoe,

I made some progress and here is the update:

I remove minOccurs="0" from the xsd file and generate a vb file again, and
then I got only one parameter in the function definition. This also
happened if I change to minOccurs="1". So I believe the problem should be
with minOccurs="0" here.

The parameter's value is determined by two

pAggregatePursesSpecified : means "Occurs"
pAggregatePurses: actual value.
Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Jun 30 '06 #9
Thanks Luke. I'll get in touch with the folks who own the web service and
the wsdl and determine if it these parameters are truly minOccurs=0. If so,
then maybe I'm stuck with the complex interface in the proxy class, but if
not, we can clean up the wsdl and simplify the proxy. Thanks again for your
help.

Zoe

"Luke Zhang [MSFT]" <lu******@online.microsoft.com> wrote in message
news:Dv**************@TK2MSFTNGXA01.phx.gbl...
Hi Zoe,

I made some progress and here is the update:

I remove minOccurs="0" from the xsd file and generate a vb file again, and
then I got only one parameter in the function definition. This also
happened if I change to minOccurs="1". So I believe the problem should be
with minOccurs="0" here.

The parameter's value is determined by two

pAggregatePursesSpecified : means "Occurs"
pAggregatePurses: actual value.
Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 30 '06 #10
Thank you for the reply. If there is any further questions, please feel
free to post here.

regards,

Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Jul 3 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: WGW | last post by:
Though I am a novice to MS SQL server (2000 I believe), I can do almost! everything I need. Maybe not efficiently, but usefully. However, I have a problem -- a complex query problem... I can...
3
by: Douwe | last post by:
I try to build my own version of printf which just passes all arguments to the original printf. As long as I keep it with the single argument version everything is fine. But their is also a version...
3
by: Chakra | last post by:
I have a Entity class defined in a assembly. I then have a web service in the same solution, which takes an object of this class as a parameter. It expects me to give the fully qualified name of...
10
by: dba123 | last post by:
Why am I getting this error for Budget? Error: An exception of type 'System.FormatException' occurred in mscorlib.dll but was not handled in user code Additional information: String was not...
4
by: Joe HM | last post by:
Hello - I realize that there is no more IsMissing function in VB.NET but how can I have a boolean argument that is optional and in the code I need to determine whether it was passed it or not? ...
4
by: Russ | last post by:
I have a python module (file) that has a set of parameters associated with it. Let's say the module is called "code.py." I would like to keep the parameter assignments in a separate file so that I...
4
by: =?Utf-8?B?QmlsbEF0V29yaw==?= | last post by:
Hi, We recently converted a 1.1 project to 2.0 and this included a webservice which accepted XML for one of the parameters. Since converting to 2.0 I am getting the following message: --- A...
8
by: flopbucket | last post by:
Hi, I want to provide a specialization of a class for any type T that is a std::map. template<typename T> class Foo { // ... };
19
by: C++Liliput | last post by:
I have a custom String class that contains an embedded char* member. The copy constructor, assignment operator etc. are all correctly defined. I need to create a map of my string (say a class...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.