WSDL自动生成的类,带有“指定的“属性 [英] WSDL auto Generated class with a " specified " property

查看:207
本文介绍了WSDL自动生成的类,带有“指定的“属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在尝试使用WSDL文件来使用web服务。文件的复杂类型是这样的..



 <   s:complexType     name   =  ArrayOfTermsAndConditionsAcceptedElement >  
< s:sequence >
< s:element minOccurs = 0 maxOccurs = 无界 名称 = TermsAndConditionsAcceptedElement nillable = true type = tns:TermsAndConditionsAcceptedElement / >
< / s:sequence >
< / s :complexType >
< s:complexType 名称 = TermsAndConditionsAcceptedElement >
< s:sequence >
< s :element minOccurs = 0 maxOccurs = 1 名称 = 名称 类型 = tns:TermsAndConditionsIdentifier / < span class =code-keyword>>
< s:element minOccurs = 0 maxOccurs = 1 name = < span class =code-attribute> type = s:boolean / >
< / s:sequence >
< span class =code-keyword>< / s:complexType >

< s:simpleType 名称 = TermsAndConditionsIdentifier >
< s:list >
< s:simpleType >
< s:restriction base = s:string >
< s:枚举 value = eReceipt / >
< / s:restriction >
< / s:simpleType < span class =code-keyword>>
< / s:list >
< / s:simpleType >







将上面的WSDL文件转换为C#类时,默认情况下会出现两个属性..以及我实际需要的属性(TermsAndConditionsIdentifier和Value)。 br />


1,NameSpecified

2,ValueSpecified



可以解释为什么这些指定的属性是默认出现的?

解决方案

大家好,



指定的属性来覆盖一个阶级的行为。假设枚举类定义为minoccurs而MaxOccurs为0,那么这种情况永远是假的。像上面的WSDL一样,如果我们提到bool值为minoccurs并且MaxOccurs为0,则语句不正确。因此,自动生成的WSDL类在这些类中提供指定的属性来覆盖。



问候,

Subbu - SKOTAJI。

Hi,

I am trying to consume a webservice using a WSDL file. file has a complex type is like this ..

<s:complexType name="ArrayOfTermsAndConditionsAcceptedElement">
       <s:sequence>
         <s:element minOccurs="0" maxOccurs="unbounded" name="TermsAndConditionsAcceptedElement" nillable="true" type="tns:TermsAndConditionsAcceptedElement" />
       </s:sequence>
     </s:complexType>
     <s:complexType name="TermsAndConditionsAcceptedElement">
       <s:sequence>
         <s:element minOccurs="0" maxOccurs="1" name="Name" type="tns:TermsAndConditionsIdentifier" />
         <s:element minOccurs="0" maxOccurs="1" name="Value" type="s:boolean"/>
       </s:sequence>
     </s:complexType>

     <s:simpleType name="TermsAndConditionsIdentifier">
       <s:list>
         <s:simpleType>
           <s:restriction base="s:string">
             <s:enumeration value="eReceipt" />
           </s:restriction>
         </s:simpleType>
       </s:list>
     </s:simpleType>




When converting this above WSDL file to a C# class, two properties coming as default .. along with my actual needy properties (TermsAndConditionsIdentifier and Value).

1, NameSpecified
2, ValueSpecified

Could any one explain why these specified properties are coming by default ?

解决方案

Hi All,

Specified property comes to override the behaviour of a class. Suppose the enumerate class defined as minoccurs and MaxOccurs is 0, then this case is forever false. like the above in WSDL if we mention bool value as minoccurs and MaxOccurs is 0, the statement is not correct. So, the auto generated classes of WSDL gives specified properties in those classes to override.

Regards,
Subbu - SKOTAJI.


这篇关于WSDL自动生成的类,带有“指定的“属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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