WebService属性排序有非常奇怪的行为。
我有WebService,它公开了下一个WSDL:
...
<s:complexType name="WsProgramPackage">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="ProgramPackageID" nillable="true" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="ProgramID" nillable="true" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="PackageID" nillable="true" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="Layer" nillable="true" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="ProgramOffset" nillable="true" type="s:decimal" />
<s:element minOccurs="1" maxOccurs="1" name="PackageOffset" nillable="true" type="s:decimal" />
<s:element minOccurs="1" maxOccurs="1" name="Duration" nillable="true" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="IsDynamic" nillable="true" type="s:boolean" />
<s:element minOccurs="1" maxOccurs="1" name="IsVisible" nillable="true" type="s:boolean" />
<s:element minOccurs="1" maxOccurs="1" name="AllowSkip" nillable="true" type="s:boolean" />
<s:element minOccurs="1" maxOccurs="1" name="ProgramUID" nillable="true" type="s1:guid" />
<s:element minOccurs="1" maxOccurs="1" name="PackageUID" nillable="true" type="s1:guid" />
</s:sequence>
</s:complexType>
...
它也应该返回下一个肥皂响应
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetProgramByIDResponse xmlns="ws.kitd.vx2.ws.cms">
<GetProgramByIDResult>
<ThumbnailURL>string</ThumbnailURL>
<TrailerURL>string</TrailerURL>
<ProgramPackages>
<WsProgramPackage>
<ProgramPackageID>int</ProgramPackageID>
<ProgramID>int</ProgramID>
<PackageID>int</PackageID>
<Layer>int</Layer>
<ProgramOffset>decimal</ProgramOffset>
<PackageOffset>decimal</PackageOffset>
<Duration>int</Duration>
<IsDynamic>boolean</IsDynamic>
<IsVisible>boolean</IsVisible>
<AllowSkip>boolean</AllowSkip>
<ProgramUID>guid</ProgramUID>
<PackageUID>guid</PackageUID>
</WsProgramPackage>
...
当我尝试在SOAP UI中调用此方法时,响应中有不同的字段排序
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetProgramByIDResponse xmlns="ws.kitd.vx2.ws.cms">
<GetProgramByIDResult>
<ThumbnailURL>http://origin.pmt.ovivo.ru/2f/59/2f59465e-7aa0-4188-9f2f-2904f92cced7.35557.203a5d20f56693df382b610354605ebf</ThumbnailURL>
<ProgramPackages>
<WsProgramPackage>
<ProgramPackageID>269310</ProgramPackageID>
<ProgramID>5190</ProgramID>
<PackageID>8855</PackageID>
<ProgramUID>ec62f0a5-c10e-4ac5-bb95-c5ab3ac6f150</ProgramUID>
<PackageUID>61d77ef1-495f-4ec8-9fac-3170a9705483</PackageUID>
<Layer>0</Layer>
<ProgramOffset>0.000</ProgramOffset>
<PackageOffset>0.000</PackageOffset>
<Duration>9469</Duration>
<IsDynamic>false</IsDynamic>
<IsVisible>false</IsVisible>
<AllowSkip>false</AllowSkip>
</WsProgramPackage>
</ProgramPackages>
...
在WSDL中,ProgramUID和PackageUID是最后的字段,但在响应中它们位于3和4位。
如何可能,响应是不同的,然后在WSDL中描述,是否有可能以某种方式修复此排序。
P.S。这是简单的旧C#WebService,而不是WCF。