Since it looks like you're writing new code, rather than maintaining existing code, you might want to consider using LINQ to XML instead: LINQ to XML Overview (C#) | Microsoft Docs[^]
using System;
using System.Xml.Linq;
using System.Xml.XPath;
namespace Shipment_WS_Test_App
{
static class Class1
{
private static readonly XNamespace XsiNamespace = "www.w3.org/2001/XMLSchema-instance";
/// <summary>
/// The main entry point for the application.
/// </summary>
\[STAThread\]
static void Main(string\[\] args)
{
try
{
using (var shipment = new saia.shipment.Shipment())
{
shipment.Timeout = 120000;
var request = new XDocument(
new XElement("AmazonTrackingRequest",
new XAttribute(XNamespace.Xmlns + "xsi", XsiNamespace),
new XAttribute(XsiNamespace + "noNamespaceSchemaLocation", "AmazonTrackingRequest.xsd"),
new XElement("Validation",
new XElement("UserID", "AMZN"),
new XElement("Password", "12345")
),
new XElement("APIVersion", "4.0"),
new XElement("TrackingNumber", "123456789")
)
);
string response = shipment.ProcessXML(request.ToString());
if (string.IsNullOrEmpty(response))
{
Console.WriteLine("No response.");
}
else
{
XDocument xmlResponse = XDocument.Parse(response);
if (xmlResponse.Root == null)
{
Console.WriteLine("No response. ({0})", response);
}
else
{
XElement responseNode = xmlResponse.Root.Element("Response");