联盟窗口商家api在asp.net c# [英] affiliate window merchant api in asp.net c#
本文介绍了联盟窗口商家api在asp.net c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在asp.net c#中实现联盟窗口商家API,但收到错误身份验证失败。不知道接下来要做什么..
错误是
System.Web.Services.Protocols .SoapException:身份验证失败
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
推荐答案
我的代码是
private void GetAW()
{
const string affiliateApiPassword =48characterpassword;
// NB有数据源,产品服务和联盟服务的密钥,因此请确保选择正确的服务
var aw = new ApiService
{
UserAuthenticationValue = new UserAuthentication
{
iId = int value,
sPassword = affiliateApiPassword,
sType = UserType.affiliate
}
};
//明显填写您的日期等...
var transactionList = new getTransactionList
{
dS tartDate = new DateTime(2013,10,30,0,0,0,0),
dEndDate = new DateTime(2013,10,07,23,59,59,999),
sDateType = DateType.transaction
};
//位XML疯狂 - 因为我们有一个命名空间..我们必须创建一个文档,以便我们可以创建一个名称空间管理器
var document = new XmlDocument();
//然后添加命名空间管理器
var manager = new XmlNamespaceManager(document.NameTable);
//然后添加aw命名空间
manager.AddNamespace(ns1,http://api.affiliatewindow.com/);
//获取交易清单
getTransactionListResponse response = aw.getTransactionList(transactionList);
//我们得到了一个resposnse
if(response!= null)
{
//我们是否收到了交易清单?
if(response.getTransactionListReturn!= null)
{
//是的,所以获取XML元素数组
ArrayOfTransaction z = response.getTransactionListReturn;
foreach(z.Any中的XmlElement thunk)
{
//这些是交易数据类型字段
// iId
XmlNode xmlNode = thunk.SelectSingleNode(// ns1:iId,manager);
if(xmlNode!= null)
{
string aa = xmlNode.InnerText;
}
$ b
//从这一点起,您可以选择要处理的字段等。
// sStatus
// sType
// sIp
// b Paid
/ / iPaymentId
// sDeclinedReason
// iMerchantId
// fSaleAmount
// fCommissionAmount
// dClickDate
// dTransactionDate
// dValidationDate
// sClickRef
// sSearchSiteName
// sSearchSiteKeyword
// aTransactionParts(包含其他项目的节点)
xmlNode = thunk.SelectSingleNode(// ns1:aTransactionParts,经理);
if (xmlNode!= null)
{
//这是另一个包含ns1的节点:TransactionPart
// sCommissionGroupName
// fSaleAmount
// iCommission
// sCommissionType
string aa = xmlNode.InnerXml;
// SelectSingleNode或忽略 - 当然你想做什么
}
}
}
}
}
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
}
}
}
}
}
这篇关于联盟窗口商家api在asp.net c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文