Click here to Skip to main content
15,942,801 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to implement affiliate window merchant API in asp.net c# but getting error Authentication Failed. Do not know what to do next..

error is

System.Web.Services.Protocols.SoapException: Authentication Failed
Posted
Comments
Sushil Mate 8-Oct-13 2:50am    
its a vague question. you need to provide more details with code snippet. have you given the credentials?
Member 10247157 8-Oct-13 2:53am    
yes i give the credentials..

1 solution

My codes are



private void GetAW()
{
const string affiliateApiPassword = "48characterpassword";

// NB there are keys for datafeed, productservice and affiliateservice so make sure you pick the right one for the right service

var aw = new ApiService
{
UserAuthenticationValue = new UserAuthentication
{
iId = int value,
sPassword = affiliateApiPassword,
sType = UserType.affiliate
}
};

// obvious fill in your dates etc...
var transactionList = new getTransactionList
{
dStartDate = new DateTime(2013, 10, 03, 0, 0, 0, 0),
dEndDate = new DateTime(2013, 10, 07, 23, 59, 59, 999),
sDateType = DateType.transaction

};

// bit of XML craziness - because we have a namespace.. we have to create a document so that we can create a name space manager
var document = new XmlDocument();

// then add the namespace manager
var manager = new XmlNamespaceManager(document.NameTable);

// then add the aw namespace
manager.AddNamespace("ns1", "http://api.affiliatewindow.com/");

// Get the list of transactions
getTransactionListResponse response = aw.getTransactionList(transactionList);

// Did we get a resposnse
if (response != null)
{
// Have we got a transaction list returned?
if (response.getTransactionListReturn != null)
{
// yes, so Get the XML element array
ArrayOfTransaction z = response.getTransactionListReturn;
foreach (XmlElement thunk in z.Any)
{
// These are the transaction data type fields
// iId

XmlNode xmlNode = thunk.SelectSingleNode("//ns1:iId", manager);
if (xmlNode != null)
{
string aa = xmlNode.InnerText;
}



// up to you from this point you can select which fields you want to deal with etc..
// sStatus
// sType
// sIp
// bPaid
// iPaymentId
// sDeclinedReason
// iMerchantId
// fSaleAmount
// fCommissionAmount
// dClickDate
// dTransactionDate
// dValidationDate
// sClickRef
// sSearchSiteName
// sSearchSiteKeyword
// aTransactionParts (node with other items in it)
xmlNode = thunk.SelectSingleNode("//ns1:aTransactionParts", manager);
if(xmlNode!=null)
{
// This is another node that contains a ns1:TransactionPart
// sCommissionGroupName
// fSaleAmount
// iCommission
// sCommissionType
string aa = xmlNode.InnerXml;

// SelectSingleNode or ignore - up to what you want to do of course
}

}
}
}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900