Click here to Skip to main content
15,890,717 members
Home / Discussions / C#
   

C#

 
GeneralRe: Windows forms... Pin
lovelylooney3-Aug-05 19:24
lovelylooney3-Aug-05 19:24 
GeneralError in .Net after adding PayPal webservice - please help!! Pin
nzmike3-Aug-05 17:11
nzmike3-Aug-05 17:11 
GeneralRe: Error in .Net after adding PayPal webservice - please help!! Pin
Christian Graus3-Aug-05 17:24
protectorChristian Graus3-Aug-05 17:24 
GeneralRe: Error in .Net after adding PayPal webservice - please help!! Pin
nzmike3-Aug-05 17:45
nzmike3-Aug-05 17:45 
GeneralRe: Error in .Net after adding PayPal webservice - please help!! Pin
Christian Graus3-Aug-05 17:54
protectorChristian Graus3-Aug-05 17:54 
GeneralRe: Error in .Net after adding PayPal webservice - please help!! Pin
nzmike3-Aug-05 18:09
nzmike3-Aug-05 18:09 
GeneralRe: Error in .Net after adding PayPal webservice - please help!! Pin
Christian Graus3-Aug-05 18:19
protectorChristian Graus3-Aug-05 18:19 
GeneralRe: Error in .Net after adding PayPal webservice - please help!! Pin
nzmike3-Aug-05 19:06
nzmike3-Aug-05 19:06 
'"PayPalAPIInterfaceService" description' is what the WSDL screen shows when you type the reference to the PayPal web services (http://www.paypal.com/wsdl/PayPalSvc.wsdl) and hit "go". It says "1 service found - PayPalSvc" and the name is com.paypal.www. I rename that to PayPalSvc and click "Add Reference". The code below in my wrapper class then tries to access PayPalAPIInterfaceService. (I've marked the error lines with "//GETS ERROR HERE".... that's where the compiler says it can't find PayPalAPIInterfaceService.)

If you want I could zip up the project and email it to you or make it downlaodable from my server... it might be easier to see waht's going on - let me know if that would help.

Thanks again,

Mike

------------ APIWrapper.cs --------------------

using System;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using PayPalAPI.PayPalSvc;
using PayPalAPI;
using System.Data;
using System.Collections;
using System.Security;

namespace PayPalAPI
{

///
/// Summary description for APIWrapper.
///

public class APIWrapper
{

string _APIUserName="";
string _APIPassword="";
string _CertLocation="";
string _APIUrl="";

public string APIUserName
{
get{return _APIUserName;}
}

public string APIPassword
{
get{return _APIPassword;}
}

public string CertLocation
{
get{return _CertLocation;}
}

public string APIUrl
{
get{return _APIUrl;}
}

PayPalAPIInterfaceService service; //GETS ERROR HERE

public APIWrapper(String APIUserName, string APIPassword, string CertLocation, string APIUrl)
{

_APIUserName=APIUserName;
_APIPassword=APIPassword;
_CertLocation=CertLocation;
_APIUrl=APIUrl;

// Add the CertificatePolicy so we can post to an untrusted site
ServicePointManager.CertificatePolicy = new MyCertificateValidation( );

service = new PayPalAPIInterfaceService( ); //GETS ERROR HERE
service.Url = _APIUrl;

// Add the X509 Cert to the service for authentication
X509Certificate certificate = X509Certificate.CreateFromCertFile(_CertLocation);
service.ClientCertificates.Add(certificate);
SetHeaderCredentials(service);

}

void SetHeaderCredentials(PayPalAPIInterfaceService service)
{

CustomSecurityHeaderType securityHeader = new CustomSecurityHeaderType( );
UserIdPasswordType userIdPassword = new UserIdPasswordType( );
userIdPassword.Username = _APIUserName;
userIdPassword.Password = _APIPassword;
//userIdPassword.Subject = subject;
securityHeader.Credentials = userIdPassword;
securityHeader.MustUnderstand = true;
service.RequesterCredentials = securityHeader;

}

string GetAmountValue(BasicAmountType amount)
{

string sOut="";

try
{
sOut="$"+amount.Value.ToString( );
amount.currencyID = CurrencyCodeType.USD;
}
catch
{
sOut="--";
}
return sOut;

}
}

class MyCertificateValidation : ICertificatePolicy
{
// Default policy for certificate validation.
public static bool DefaultValidate = false;

public bool CheckValidationResult(ServicePoint sp, X509Certificate cert, WebRequest request, int problem)
{
//implement your custom code here
return true;
}
}

}

------------ APIWrapper.cs --------------------
GeneralRe: Error in .Net after adding PayPal webservice - please help!! Pin
Christian Graus3-Aug-05 19:09
protectorChristian Graus3-Aug-05 19:09 
GeneralRe: Error in .Net after adding PayPal webservice - please help!! Pin
nzmike3-Aug-05 19:21
nzmike3-Aug-05 19:21 
GeneralRe: Error in .Net after adding PayPal webservice - please help!! Pin
Christian Graus3-Aug-05 19:35
protectorChristian Graus3-Aug-05 19:35 
GeneralRe: Error in .Net after adding PayPal webservice - please help!! Pin
nzmike3-Aug-05 20:43
nzmike3-Aug-05 20:43 
GeneralASP.NET/C#/CDO COMException.. PLEASE HELP! Pin
Jonathan W. Zaleski3-Aug-05 11:21
Jonathan W. Zaleski3-Aug-05 11:21 
GeneralDate Format Pin
Ming Luo3-Aug-05 10:52
Ming Luo3-Aug-05 10:52 
GeneralRe: Date Format Pin
Rob Graham3-Aug-05 11:24
Rob Graham3-Aug-05 11:24 
GeneralRe: Date Format Pin
Ming Luo4-Aug-05 6:30
Ming Luo4-Aug-05 6:30 
GeneralRe: Date Format Pin
Guffa3-Aug-05 13:16
Guffa3-Aug-05 13:16 
GeneralRe: Date Format Pin
Ming Luo4-Aug-05 6:27
Ming Luo4-Aug-05 6:27 
GeneralRe: Date Format Pin
Guffa5-Aug-05 4:08
Guffa5-Aug-05 4:08 
GeneralWindows account information Pin
lrech3-Aug-05 10:17
lrech3-Aug-05 10:17 
GeneralRe: Windows account information Pin
Peter Vertes3-Aug-05 11:28
Peter Vertes3-Aug-05 11:28 
GeneralRe: Windows account information Pin
Mohamad Al Husseiny3-Aug-05 13:10
Mohamad Al Husseiny3-Aug-05 13:10 
GeneralRe: Windows account information Pin
Mohamad Al Husseiny3-Aug-05 13:13
Mohamad Al Husseiny3-Aug-05 13:13 
GeneralSoftware Protection Pin
damir_tk3-Aug-05 9:53
damir_tk3-Aug-05 9:53 
GeneralRe: Software Protection Pin
Lars Niedziolka3-Aug-05 13:45
Lars Niedziolka3-Aug-05 13:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.