3 How to Connect to Thru SOAP Service from Visual Studio
Create project in Visual Studio, such as sample WinForms project on the screenshot below.
Right click on project and choose “Add Service Reference…”
Enter URL to web service, typical URL looks like
<domain name>/WS4/FTHService.asmx
Click Go button, enter namespace name and click “OK”.Now you should find out your service reference in solution explorer.
SOAP web service can be called now as shown in the sample:
ThruService.FTHServiceSoapClient service = null;
try
{
service = new ThruService.FTHServiceSoapClient("FTHServiceSoap", serverURL.Text);
var sessionData = service.Open(username.Text, password.Text, 1, "1");
var sessionID = sessionData.SessionID;
var root = service.GetRootFolder(sessionID);
var subfolders = service.GetFolders(sessionID, root.FolderID, 0, -1);
if (subfolders.Length == 0)
return;
service.CreateFolder(sessionID, subfolders[0].FolderID, newFolderName.Text);
}
catch (Exception)
{
if (service != null)
service.Close();
}