Web services are a standard XML-based way for one program to call functions on another program that exposes Web services. Because each programming environment has its own way of calling Web services, this example assumes that you are using Microsoft.NET. If you are using another programming environment, such as Java or Cold Fusion, you will need to refer to other documentation to find out how to use Web services from those platforms.
For specific functions to use for Web services, please refer to SmarterMail Automation with Web Services
Calling SmarterMail's Web Services
Follow these steps to call SmarterMail's Web services using Microsoft.NET:
- In Solution Explorer, right-click on the solution and select Add Service Reference (also called Add Web Reference in VS2005 or earlier) then click Advanced and then Add Web Reference.
- For the URL, you will want to enter the path to the appropriate ASMX page that defines a particular web service. For example, the default path to the domain administration Web service is http://127.0.0.1:9998/Services/svcDomainAdmin.asmx. If you change the path to your webmail from http://127.0.0.1:9998 to something like http://mail.yourdomain.com, then you would change the path to the domain administration Web service to http://mail.yourdomain.com/services/svcDomainAdmin.asmx.
- When you have entered the path to the Web services ASMX page, click Go and VS.Net will look there for the definition of the web service.
- Set the Web reference name to whatever you want as the namespace to this web service and click the Add Reference button.
- This will create a wrapper class for you to use to call the web service. The web reference name you gave is how you will access the root of the wrapper class that was created. If you gave a reference name of DomainAdminService, this is how you would add a domain called yourdomain.com:
DomainAdminService.svcDomainAdminSoapClient svcDomainAdmin = new DomainAdminService.svcDomainAdminSoapClient();
svcDomainAdmin.AddDomainEx("admin", "admin", "yourdomain.com", "c:\\SmarterMail\\Domains\\yourdomain.com",
"domainadmin", "domainAdminPassword", "domainAdminFirstName", "domainAdminLastName", "192.168.0.1");
- The first two fields are the SmarterMail administrator username and password. You will pass these in as the first two fields of every Web service function call. The next field is the domain name and then a bunch of settings for that domain.
- Use these same methods for each service you wish to call.