forked from jasonburt/AvaTaxCalcSOAP-csharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PingTest.cs
41 lines (35 loc) · 1.4 KB
/
PingTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
namespace AvaTaxCalcSOAP
{
using System;
using System.Configuration;
using Avalara.AvaTax.Adapter;
using Avalara.AvaTax.Adapter.TaxService;
public class PingTest
{
public static void Test()
{
string accountNumber = ConfigurationManager.AppSettings["AvaTax:AccountNumber"];
string licenseKey = ConfigurationManager.AppSettings["AvaTax:LicenseKey"];
string serviceURL = ConfigurationManager.AppSettings["AvaTax:ServiceUrl"];
TaxSvc taxSvc = new TaxSvc();
// Header Level Parameters
// Required Header Parameters
taxSvc.Configuration.Security.Account = accountNumber;
taxSvc.Configuration.Security.License = licenseKey;
taxSvc.Configuration.Url = serviceURL;
taxSvc.Configuration.ViaUrl = serviceURL;
taxSvc.Profile.Client = "AvaTaxSample";
// Optional Header Parameters
taxSvc.Profile.Name = "Development";
PingResult pingResult = taxSvc.Ping(string.Empty);
Console.WriteLine("PingTest Result: " + pingResult.ResultCode.ToString());
if (!pingResult.ResultCode.Equals(SeverityLevel.Success))
{
foreach (Message message in pingResult.Messages)
{
Console.WriteLine(message.Summary);
}
}
}
}
}