Reputation: 47773
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;
}
Upvotes: 1
Views: 95
Reputation: 25820
From the eBay API Example
Credentials needs to be instantiated first, like:
Credentials = new UserIdPasswordType()
Upvotes: 1
Reputation: 29256
I am thinking you need a new....
Credentials = new WhatEverThisTypeIs()
{
Username = PayPalConfig.CurrentConfiguration.ApiUserName,
Password = PayPalConfig.CurrentConfiguration.ApiPassword
}
Upvotes: 4