布尔参数映射到代理中的两个单独参数? [英] Boolean parameter maps to two separate parameters in proxy?

查看:46
本文介绍了布尔参数映射到代理中的两个单独参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我从第三方收到的wsdl文件,我正在使用wsdl.exe

(.NET 2.0)导入它并生成代理类。我实际上有一个

代理类可以工作,但我想知道为什么wsdl.exe做了什么

它做了什么以及是否复杂它被添加到界面是

必要或可避免。


wsdl文件为其中一个
$指定一个布尔参数pAggregatePurses b $ b网络服务方法。在代理类方法中,由两个

单独的参数表示:


< System.Xml.Serialization.XmlElementAttribute(IsNu llable:= true)> ; ByVal

pAggregatePurses As System.Nullable(Of Boolean)





< System.Xml.Serialization .XmlElementAttribute(IsNu llable:= true),

System.Xml.Serialization.XmlIgnoreAttribute()> ByVal

pAggregatePursesSpecified As Boolean


我在wsdl文件中看不到会导致此方法的任何内容

签名。使用布尔参数处理

时,这是wsdl.exe实用程序的正常行为吗?有必要吗?任何人都可以解释为什么它的工作方式

它的方式是什么?


谢谢,

Zoe

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

推荐答案

你好Zoe,


我只是用布尔参数测试一个简单的web服务,但我没找到

代理类中的两个独立参数。所以我认为这应该是与您获得的WSDL文件相关的
。您是否可以提供

WSDL文件来缩小问题范围?


问候,


Luke Zhang

Microsoft在线社区负责人


======================= ===========================

在回复帖子时,请回复群组通过你的新闻阅读器

其他人可以从你的问题中学习并从中受益。

==================== ==============================


(此帖子提供AS IS,没有任何保证,并且不授予

权利。)
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.)


Luke,


WSDL不是我的,可能包含Web /
服务提供商和/或我的客户(Web服务消费者)专有的信息。但是我已经再次看了它,并猜测发生了什么。沿着WSDL,我获得了一组XML和XSD文件,它们提供了支持

的定义。其中一个XSD文件提供了一种类型的定义,

表示我正在使用的方法的完整输入参数集。

该类型定义适用于一个复杂的类型和有问题的参数是这个复杂类型的一个元素。使用XSD的元素定义如下所示:




< xsd:element name =" someName"类型= QUOT; XSD:布尔" nillable =" true"

minOccurs =" 0" />


我想知道它是否是type =" xsd:boolean"的组合。和

nillable =" true"属性。由于布尔值通常不可为空,因此你需要两条信息 - 1)是否设置了一个值并且

2)实际值仅在(1)为True时有效。即便如此,

类型的System.Nullable(Of Boolean)似乎涵盖了System.Nullable类型元素中的两段

信息,所以我是仍然有点混淆为什么WSDL.exe工具生成了一个全新的,单独的

参数来指示是否提供了一个值。


谢谢,

Zoe


" Luke Zhang [MSFT]" <卢****** @ online.microsoft.com>在消息中写道

新闻:2Y ************** @ TK2MSFTNGXA01.phx.gbl ...
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...
你好Zoe, WSDL文件,以缩小问题范围?

问候,

Luke Zhang
Microsoft在线社区负责人

=========================================== =======
在回复帖子时,请回复群组通过您的新闻阅读器,以便其他人可以从您的问题中学习并从中受益。
============================ ======================

(此帖子按原样提供,没有任何保证,并且不授予
权限。)
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.)



你好,


分隔参数之间的主要区别是:

System.Xml.Serialization.XmlIgnoreAttribute(),表示不对
序列化参数。我想这可能与以下内容有关:


minOccurs =" 0"


您如何看待这个?


Luke Zhang

Microsoft在线社区负责人


================= =================================

在回复帖子时,请回复分组通过你的新闻阅读器

其他人可以从你的问题中学习并从中受益。

==================== ==============================


(此帖子提供AS IS,没有任何保证,并且不授予

权利。)
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.)


这篇关于布尔参数映射到代理中的两个单独参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆