我正在尝试使用新的GetHotelDescriptiveInfo服务并创建了邮件头对象,因为我在过去创建了其他v1请求而没有问题,但是当我执行它时对于此服务我得到以下错误响应:
<ns4:ApplicationResults xmlns:ns4="http://services.sabre.com/STL_Payload/v02_01" status="NotProcessed">
<ns4:Error type="Validation" timeStamp="2016-10-21T08:15:07.497-05:00">
<ns4:SystemSpecificResults>
<ns4:Message code="ERR.NGHP-CONTENT.CLIENT.INVALID_REQUEST">
SabreHeader/Service missing or incomplete
</ns4:Message>
</ns4:SystemSpecificResults>
</ns4:Error>
</ns4:ApplicationResults>
以下是用于创建MessageHeader对象的代码;
MessageHeader header = new MessageHeader();
header.ConversationId = this.Session.ConversationId;
From from = new From();
PartyId fromPartyId = new PartyId();
fromPartyId.Value = "WebServiceClient";
PartyId[] fromPartyIdArr = new PartyId[1];
fromPartyIdArr[0] = fromPartyId;
from.PartyId = fromPartyIdArr;
header.From = from;
To to = new To();
PartyId toPartyId = new PartyId();
toPartyId.Value = "WebServiceSupplier";
PartyId[] toPartyIdArr = new PartyId[1];
toPartyIdArr[0] = toPartyId;
to.PartyId = toPartyIdArr;
header.To = to;
header.CPAId = this.Session.PCC;
header.Action = "GetHotelDescriptiveInfoRQ";
header.Service = new Service();
header.Service.Value = "GetHotelDescriptiveInfoRQ";
MessageData msgData = new MessageData();
msgData.MessageId = String.Format("mid:{0}@clientofsabre.com1", DateTime.Now.ToString("yyyyMMDD-HHmmss-ffff"));
msgData.Timestamp = String.Format("{0}Z", DateTime.UtcNow.ToString("s"));
header.MessageData = msgData;
我不确定标题中缺少什么。它是一条信息还是我的服务价值不正确。我尝试了很多服务价值的变化而没有成功。有没有人遇到过这个错误?
更新:
以下是生成的xml,屏蔽了敏感数据的示例。
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmln s:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<MessageHeader xmlns="http://www.ebxml.org/namespaces/messageHeader">
<From>
<PartyId>WebServiceClient</PartyId>
</From>
<To>
<PartyId>WebServiceSupplier</Party Id>
</To>
<CPAId>XXXX</CPAId>
<ConversationId>XXXXXXXXXXXXXXXX</ConversationId>
<Service>GetHotelDescriptiveInfoRQ</Service>
<Action>GetHotelDescriptiveInfoRQ</Action>
<MessageData>
<MessageId>mid:201611DD-0934 50-6693@clientofsabre.com</MessageId>
<Timestamp>2016-11-21T14:3 4:50Z</Timestamp>
</MessageData>
</MessageHeader>
<Security xmlns="http://schemas.xmlsoap.org/ws/2002/12/secext">
<BinarySecurityToken>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</BinarySecurityToken>
</Security>
</soap:Header>
<soap:Body>
<GetHotelDescriptiveInfoRQ xmlns="http://services.sabre.com/hotel/descriptiveinfo/v1">
<HotelRefs>
<HotelRef HotelCode="2355" />
<HotelRef HotelCode="2356" />
</HotelRefs>
<DescriptiveInfoRef>
<PropertyInfo>true</PropertyInfo>
<LocationInfo>true</LocationInfo>
<Amenities>true</Amenities>
<Airports>true</Airports>
<AcceptedCreditCards>false</AcceptedCreditCards>
</DescriptiveInfoRef>
</GetHotelDescriptiveInfoRQ>
</soap:Body>
</soap:Envelope>
更新:我能够使用REST实现使服务工作,但仍然对SOAP实现的错误感到好奇。
由于
答案 0 :(得分:1)
我只是将版本参数添加到正文中的主要请求标记中来解决此错误:版本=&#34; 1.0.0&#34; 。
在:
<GetHotelDescriptiveInfoRQ xmlns="http://services.sabre.com/hotel/descriptiveinfo/v1">
后:
<GetHotelDescriptiveInfoRQ version="1.0.0" xmlns="http://services.sabre.com/hotel/descriptiveinfo/v1">
答案 1 :(得分:0)
在整个API中保持任何标准时,Sabre都极为混乱。 该API在标头中不接受“服务”。
替换
"Service" => "GetHotelDescriptiveInfoRQ",
与
"Service" => "",
在标题中。