tags:

views:

34

answers:

2

I keep getting a null exception at the ; below. The ApiUsername & ApiPassword have values so I don't undestand if I just set this up wrong or what. The Credentials property is a certain type which has the Username and Password properties that need to be set.

So I have the auto-propery defined: public CustomSecurityHeaderType SoapCallCredentials { get; private set; }

Then whenever this is hit, I get a null exception and can't figure out why.

private void SetApiCredentials()
{
    SoapCallCredentials = new CustomSecurityHeaderType
    {
        Credentials = 
        {
            Username = PayPalConfig.CurrentConfiguration.ApiUserName,
            Password = PayPalConfig.CurrentConfiguration.ApiPassword
        }
    };

    UrlEndPoint = PayPalConfig.CurrentConfiguration.ExpressCheckoutSoapApiEndPoint;
}
+3  A: 

I am thinking you need a new....

Credentials = new WhatEverThisTypeIs()
{
    Username = PayPalConfig.CurrentConfiguration.ApiUserName,
    Password = PayPalConfig.CurrentConfiguration.ApiPassword
}
Muad'Dib
+1  A: 

From the eBay API Example

Credentials needs to be instantiated first, like:

Credentials = new UserIdPasswordType()
o.k.w