We have upgraded the EnhancedAirBook to latest version 3.2.0.
We use Visual Studio 2013 (Update 5) for consuming the EnhancedAirBook as Web reference.
On code, we set up the EnhancedAirBook Request object.
When adding OTA_AirPriceRQ to request we set the PriceRequestInformation Retain attribute="true".
But when we desalinize the request object to string and view the XML, there not exists Retain attribute on the PriceRequestInformation element (see below).
request.OTA_AirPriceRQ = new EnhancedAirBookRQOTA_AirPriceRQ
{
PriceRequestInformation = new EnhancedAirBookRQOTA_AirPriceRQPriceRequestInformation
{
OptionalQualifiers =
new EnhancedAirBookRQOTA_AirPriceRQPriceRequestInformationOptionalQualifiers
{
PricingQualifiers =
new EnhancedAirBookRQOTA_AirPriceRQPriceRequestInformationOptionalQualifiersPricingQualifiers
{
CurrencyCode = paramsService.Currency
}
},
Retain = true
}
};
The deserialized representation of it is:
<OTA_AirPriceRQ xmlns="http://services.sabre.com/sp/eab/v3_2">
<PriceRequestInformation>
<OptionalQualifiers>
<PricingQualifiers CurrencyCode="USD">
<PassengerType Code="ADT" Quantity="1" />
</PricingQualifiers>
</OptionalQualifiers>
</PriceRequestInformation>
We found workaround.
Remark/Delete all the other PriceRequestInformation attributes on the Reference.cs file of EnhancedAirBook and leave the Retain attribute only. (See below)
Code:
/// <remarks/>
//[System.Xml.Serialization.XmlAttributeAttribute()]
//public bool FutureTicket
//{
// get
// {Re
// return this.futureTicketField;
// }
// set
// {
// this.futureTicketField = value;
// }
//}
/// <remarks/>
//[System.Xml.Serialization.XmlIgnoreAttribute()]
//public bool FutureTicketSpecified
//{
// get
// {
// return this.futureTicketFieldSpecified;
// }
// set
// {
// this.futureTicketFieldSpecified = value;
// }
//}
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
public bool Retain {
get {
return this.retainField;
}
set {
this.retainField = value;
}
}
/// <remarks/>
//[System.Xml.Serialization.XmlIgnoreAttribute()]
//public bool RetainSpecified
//{
// get
// {
// return this.retainFieldSpecified;
// }
// set
// {
// this.retainFieldSpecified = value;
// }
//}
The deserialized representation of it is:
<OTA_AirPriceRQ xmlns="http://services.sabre.com/sp/eab/v3_2">
<PriceRequestInformation Retain="true">
<OptionalQua lifiers>
<PricingQualifiers CurrencyCode="USD">
<PassengerType Code="ADT" Quantity="1" />
</PricingQualifiers>
</OptionalQualifiers>
</PriceRequestInformation>
Is there any other way to set attributes without making modifications to the Reference.cs file?
Setting RetainSpecified = true will resolve the issue.
The [AttributeName]Specified attributes used to set optional xml attributes.