Cancel a complete PNR
<p>I'm writing a service which automtically cancels a PNR left on a certain queue. This sounds pretty straight forward with the OTA_CancelLLSRQ request, however it appears I have to loop through each segment individually, or is there a way I can cancell ALL segments at once?</p>

<p>In the application we defined a PNR class, this class contains all of the information we can obtain with the "" call.</p>

<p>To cancel the PNR I currently use the following code:</p>

<pre><code>MessageHeader msgHeader = new MessageHeader
{
    ConversationId = "TestSession",
    CPAId = licenseId,
    Action = "OTA_CancelLLSRQ",
    Service = new Service { Value = "OTA_CancelLLSRQ" },
    MessageData = new MessageData
    {
        MessageId = "xxx",
        Timestamp = DateTime.UtcNow.ToString("s") + "Z"
    },
    From = new From()
    {
        PartyId = new PartyId[]
        {
            new PartyId { Value = "WebServiceClient"}
        }
    },
    To = new To()
    {
        PartyId = new[]
        {
            new PartyId { Value = "WebServiceSupplier"}
        }
    }
};

var segmentList = new List&lt;OTA_CancelRQSegment&gt;();
foreach (var segment in pnrObject.Segments)
{
    var requestSegment = new OTA_CancelRQSegment
    {
        Number = segment.SegmentNumber.ToString()
    };

    segmentList.Add(requestSegment);
}

var request = new OTA_CancelRQ()
{
    Version = "2.0.0",
    TimeStamp = DateTime.UtcNow,
    TimeStampSpecified = true,
    Segment = segmentList.ToArray()
};

OTA_CancelRS response = null;
Policy.Handle&lt;SoapException&gt;()
      .Or&lt;WebException&gt;()
      .WaitAndRetry(new[]
      {
          TimeSpan.FromSeconds(1),
          TimeSpan.FromSeconds(1),
          TimeSpan.FromSeconds(1),
          TimeSpan.FromSeconds(1),
          TimeSpan.FromSeconds(1),
          TimeSpan.FromSeconds(1),
          TimeSpan.FromSeconds(1),
          TimeSpan.FromSeconds(1),
          TimeSpan.FromSeconds(1)
      })
      .Execute(() =&gt;
      {
          using (OTA_CancelService serviceObj = new OTA_CancelService())
          {
              serviceObj.MessageHeaderValue = msgHeader;
              serviceObj.Security = new Security1 { BinarySecurityToken = token };
              response = serviceObj.OTA_CancelRQ(request);
          }
});
</code></pre>

<p>It compiles &amp; builds, but I haven't gotten around testing it just yet. :-)</p>

<p>In the documentation I found the following request:</p>

<pre><code>&lt;OTA_CancelRQ Version="2.0.0"&gt;
  &lt;Segment Type="entire"/&gt;
&lt;/OTA_CancelRQ&gt;
</code></pre>

<p>How do I encode this using the object model the webservice expects?</p>