"Object reference not set to an instance of an object" when calling DiscountAsp API

Discussion in 'Control Panel API' started by ngocluu, Oct 12, 2009.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. "SMAddAlias" works fine, but I got this error when call "SMDeleteAlias" to delete an email alias:

    Code:
    System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object.
      at HostCollective.HtmlError.GetHtmlError(Exception ex)
      at HostCollective.HtmlError.SmtpSend(Exception ex, String from, String to, String subject, String smtpServer)
      at HostCollective.HtmlError.SmtpSend(Exception ex, String from, String to, String subject)
      at Logging.EmailError(Exception ex) in e:\web\api_live\App_Code\Logging.cs:line 50
      at Logging.WriteLog(Int32 prismId, MessageType messageType, Exception ex, Boolean sendEmail) in e:\web\api_live\App_Code\Logging.cs:line 26
      at DiscountASP.net.CustomerApi.SMDeleteAlias(String key, String domainName, String aliasName) in e:\web\api_live\App_Code\1.0\CustomerApi.cs:line 1627
      --- End of inner exception stack trace ---
    What's wrong :mad:
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    pls post code.
     
  3. Thanks for quickly response.
    This is my code:
    Code:
    public static void DeleteEmailAlias(string alias)
            {
                var api = new DiscountASP.API.CustomerApi();
                api.SMDeleteAlias(APIKey, Domain, alias);
            }
    The class DiscountASP.API.CustomerApi was created by "Add Web Reference" from Visual Studio.
     
  4. My guess is you are passing a null value for the alias name. But we'll bug this so that it checks for null values.
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page