[英]Search Traveler Profile by Phone Number
I am trying to retrieve all profiles associated with a specific phone number.我正在尝试检索与特定电话号码关联的所有配置文件。 I have pulled all of the phone numbers I'm testing with directly from Sabre.我已经直接从 Sabre 那里提取了我正在测试的所有电话号码。 When I used a number associated with multiple profiles, the search correctly returns multiple profiles.当我使用与多个配置文件关联的数字时,搜索会正确返回多个配置文件。 If I use a phone number associated with just one profile, I receive the message 'No profiles match'.如果我使用仅与一个配置文件关联的电话号码,我会收到消息“没有配置文件匹配”。 Is there anything that could be causing this?有什么可能导致这种情况吗? Do I need to be setting a flag or something on the Telephone field?我是否需要在电话字段上设置标志或其他内容?
Search Profile Request搜索配置文件请求
<Sabre_OTA_ProfileSearchRQ Version="6.61.4" xmlns="http://www.sabre.com/eps/schemas">
<ProfileSearchCriteria ProfileNameOnly="N" PageNumber="1" ReturnCount="250">
<TPA_Identity DomainID="*" ProfileTypeCode="TVL" ClientCode="TN" ClientContextCode="TMP" />
<Telephone>
<FullPhoneNumber>555-555-5555</FullPhoneNumber>
</Telephone>
</ProfileSearchCriteria>
Search Profile Response搜索配置文件响应
<Sabre_OTA_ProfileSearchRS xmlns="http://www.sabre.com/eps/schemas" TimeStamp="2022-08-24T20:09:20.327Z" Version="6.74">
<ResponseMessage>
<Success />
</ResponseMessage>
<ProfileInfo>
<Message>No profiles are found which match your selection criteria</Message>
</ProfileInfo>
</Sabre_OTA_ProfileSearchRS>
If you xml has multiple profiles I would recommend using a dictionary along with xml linq.如果您 xml 有多个配置文件,我建议您使用字典和 xml linq。 Xml has a default namespace that you have to use in the search. Xml 有一个您必须在搜索中使用的默认命名空间。
using System;
using System.Linq;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Linq;
namespace ConsoleApp2
{
class Program
{
const string FILENAME = @"c:\temp\test.xml";
static void Main(string[] args)
{
XDocument doc = XDocument.Load(FILENAME);
XNamespace ns = doc.Root.GetDefaultNamespace();
Dictionary<string, XElement> dict = doc.Descendants(ns + "ProfileSearchCriteria")
.GroupBy(x => (string)x.Descendants(ns + "FullPhoneNumber").FirstOrDefault(), y => y)
.ToDictionary(x => x.Key, y => y.FirstOrDefault());
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.