如何使用Sabre EnhancedSeatMap v5.0.0服务作为.Net Web Reference

时间:2017-11-15 08:16:00

标签: sabre

使用旧的v2.0.0后,我们决定将Sabre SOAP EnhancedSeatMap升级到v5.0.0。我们将它用作C#.NET 4.5项目的Web引用(不是服务引用)。使用以下命令实例化新升级的服务时:

var x = new EnhancedSeatMapService();

例外:

Cannot convert type 'ServiceSupplier_Sabre.EnhancedSeatMapRQ.Amenity_Detail[]' to
'ServiceSupplier_Sabre.EnhancedSeatMapRQ.Amenity_Detail'

error CS0030: Cannot convert type 'ServiceSupplier_Sabre.EnhancedSeatMapRQ.Price_AndTaxDescription_Detail[]' to
'ServiceSupplier_Sabre.EnhancedSeatMapRQ.Price_AndTaxDescription_Detail'

error CS0030: Cannot convert type 'ServiceSupplier_Sabre.EnhancedSeatMapRQ.Amenity_Detail[]' to
'ServiceSupplier_Sabre.EnhancedSeatMapRQ.Amenity_Detail'

error CS0030: Cannot convert type 'ServiceSupplier_Sabre.EnhancedSeatMapRQ.Price_AndTaxDescription_Detail[]' to
'ServiceSupplier_Sabre.EnhancedSeatMapRQ.Price_AndTaxDescription_Detail'

error CS0029: Cannot implicitly convert type 'ServiceSupplier_Sabre.EnhancedSeatMapRQ.Amenity_Detail' to
'ServiceSupplier_Sabre.EnhancedSeatMapRQ.Amenity_Detail[]'

error CS0029: Cannot implicitly convert type 'ServiceSupplier_Sabre.EnhancedSeatMapRQ.Price_AndTaxDescription_Detail' to
'ServiceSupplier_Sabre.EnhancedSeatMapRQ.Price_AndTaxDescription_Detail[]'

error CS0029: Cannot implicitly convert type 'ServiceSupplier_Sabre.EnhancedSeatMapRQ.Amenity_Detail' to
'ServiceSupplier_Sabre.EnhancedSeatMapRQ.Amenity_Detail[]'

error CS0029: Cannot implicitly convert type 'ServiceSupplier_Sabre.EnhancedSeatMapRQ.Price_AndTaxDescription_Detail' to
'ServiceSupplier_Sabre.EnhancedSeatMapRQ.Price_AndTaxDescription_Detail[]' 

在Sabre API文档中,明确声明此版本支持.net:

enter image description here

请帮忙

1 个答案:

答案 0 :(得分:3)

这实际上是因为一个.NET错误,它将序列带有 maxOccurs =“1000”,而不是将其理解为1000限制,或者只是作为一个数组,.NET创建一个数组数组。

<xsd:complexType name="AmenityTable">
    <xsd:sequence>
        <xsd:element name="AmenityDetail" maxOccurs="1000" minOccurs="0" type="imap-0400:Amenity_Detail">

这是双数组:

[System.Xml.Serialization.XmlArrayItemAttribute("AmenityDetail", typeof(Amenity_Detail), IsNullable=false)]
public Amenity_Detail[][] AmenityTable {
    get {
        return this.amenityTableField;
    }
    set {
        this.amenityTableField = value;
    }
}

您只需下载包含所有架构的WSDL,然后从maxOccurs="1000"imap-0400:Amenity_Detail中删除imap-0400:Price_AndTaxDescription_Detail

如果没有,您可以使用我的修改版本:https://files.fm/f/guzxxkkn