XML-RPC |
![]() |
[XML-PRC index]
-> C# .Net
Below is an example of how to use the SECVPN XML-RPC API with the Cook Computing C# .Net Library to place a test transaction on the SECPay server.
Many thanks to Stelios Vassiliou of Dot.Cy Developments Ltd for donating the following example:Simple XMLRPC Client Example
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Example for implementing an XML-RPC client for the Secpay's XML-RPC service.
* Example only no warranty of any kind is implied or given.
* This code should be tailored for your own purposes and thoroughly tested.
*
* Provided by:
* Stelios Vassiliou (VassiliouS@dotcy.com.cy)
* Dot.Cy Developments Ltd,
* Nicosia,
* Cyprus.
* (http://www.dotcy.com.cy)
*
* */
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using CookComputing.XmlRpc;
namespace namespaceGoesHere
{
[XmlRpcUrl("https://www.secpay.com/secxmlrpc/make_call")]
interface IValidateCardFull
{
[XmlRpcMethod("SECVPN.validateCardFull")]
String validateCardFull(string merchant, string pass, string trans_id,
string ip, string name, string cn, string amount,
string ed, string issue, string sd, string order,
string shipping, string billing, string options);
}
///
/// Summary description for __CardTest.
///
public class __CardTest : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
IValidateCardFull proxy = (IValidateCardFull) XmlRpcProxyGen.Create(typeof(IValidateCardFull));
try
{
string testString = proxy.validateCardFull("secpay","secpay","nettest","212.31.98.211", ".NET test", "4444333322221111", "10.00", "0505", "", "", "", "", "", "test_status=true,dups=false");
Response.Write(testString); // prints ?valid=true&trans_id=nettest&code=A&auth_code=9999&amount=10.0&test_status=true
}
catch(XmlRpcFaultException fex)
{
Response.Write(fex.FaultString);
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
Further Information
(c)Copyright 2002 SECPay Ltd., All Rights Reserved.