473,394 Members | 1,932 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 2314
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.