N911WebService.ServiceClient n911WebService = new N911WebService.ServiceClient();

 

String vendorCode = "955";        

String soapPasscode = "asdlfkj()*$JFU)SDf)SDuf";

String hash = null;

MD5 md5 = MD5.Create();

byte[] data = Encoding.ASCII.GetBytes(vendorCode + soapPasscode + GetGMTDateString());

data = md5.ComputeHash(data);

StringBuilder sb = new StringBuilder();

for (int i = 0; i < data.Length; i++)

{

    sb.Append(data[i].ToString("x2"));

}

hash = sb.ToString();

 

N911WebService.Customer c = new N911WebService.Customer();

c.VENDOR_CODE = "955";

c.PHONE_NUMBER = "7055551234";

c.LAST_NAME = "Smith";

c.FIRST_NAME = "John";

c.STREET_NUMBER = "123";

c.SUITE_APT = "b";

c.STREET_NAME = "Main Street";

c.CITY = "Sudbury";

c.PROVINCE_STATE = "ON";

c.POSTAL_CODE_ZIP = "P3A 2Z7";

c.OTHER_ADDRESS_INFO = "Front Door";

c.ENHANCED_CAPABLE = "Y";

 

N911WebService.N911Response n911Response = n911WebService.AddorUpdateCustomer(c, hash);

 

//AddUpdate Accepted.

if (n911Response.Accepted)

{

    Console.WriteLine("Add/Update Accepted.");

}

else

{

    Console.WriteLine("Add/Update Not Accepted.");

 

    //Display all errors:

    for (int i = 0; i < n911Response.Errors.Length; i++)

    {

        Console.WriteLine("Error Code: " + n911Response.Errors[i].ErrorCode);

        Console.WriteLine("Error Message: " + n911Response.Errors[i].ErrorMessage);

    }

}

 

n911WebService.Close();

 

public static String GetGMTDateString()

{

return DateTime.UtcNow.ToString("yyyyMMdd");

}