PDA

View Full Version : "Object reference not set to an instance of an object" when calling DiscountAsp API


ngocluu
10-12-2009, 09:58 AM
"SMAddAlias" works fine, but I got this error when call "SMDeleteAlias" to delete an email alias:

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:

bruce
10-12-2009, 10:00 AM
pls post code.

ngocluu
10-12-2009, 10:03 AM
pls post code.

Thanks for quickly response.
This is my 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.

Aristotle
10-13-2009, 06:07 PM
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.