Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
integration:foxycart:test_xml_post_with_csharp [2011/06/02 06:15] – Added ASP.Net to Systemss ssyladinintegration:foxycart:test_xml_post_with_csharp [2017/04/26 07:02] (current) – external edit 127.0.0.1
Line 4: Line 4:
 name          : FoxyCart XML Test Generator in C\# # the name of the integration name          : FoxyCart XML Test Generator in C\# # the name of the integration
 description   : Code in C\# to generate and post a FoxyCart XML datafeed on demand.  description   : Code in C\# to generate and post a FoxyCart XML datafeed on demand. 
-tags_tags     : xml, datafeed, testing, C\#, .net, dotnet # tags, separated by commas. don't include the "system" here.+tags          : xml, datafeed, testing, C\#, .net, dotnet # tags, separated by commas. don't include the "system" here.
 date_dt       : 2011-06-01 # the date in YYYY-MM-DD format date_dt       : 2011-06-01 # the date in YYYY-MM-DD format
 version       : 1.1 # if you have a version for your code, enter it here version       : 1.1 # if you have a version for your code, enter it here
Line 12: Line 12:
  
 ====== test xml post with csharp ====== ====== test xml post with csharp ======
 +
 +<WRAP important round>
 +//**Please note:**//
 +The code on this page is submitted by members of the FoxyCart community, and may not verified by FoxyCart.com LLC in any way, shape, or form. Please double check the code before installing. If you need help with it please [[http://forum.foxycart.com/|post in our forum]], but if we cannot offer assistance (due to unfamiliarity with this particular system or language) we apologize in advance.
 +</WRAP>
 +
 ===== Description ===== ===== Description =====
 The purpose of this file is to help you set up and debug your FoxyCart XML DataFeed scripts. It's designed to mimic FoxyCart.com and send [[:v:0.6.0:docs:datafeed|encrypted and encoded XML]] to a URL of your choice. It will print out the response that your script gives back, which should be "foxy" if successful. The purpose of this file is to help you set up and debug your FoxyCart XML DataFeed scripts. It's designed to mimic FoxyCart.com and send [[:v:0.6.0:docs:datafeed|encrypted and encoded XML]] to a URL of your choice. It will print out the response that your script gives back, which should be "foxy" if successful.
Line 17: Line 23:
  
 ===== Installation ===== ===== Installation =====
-Compile the following code.  Create or use a sample datafeed document that is saved as "SampleData.xml" in the output executable's directory.+Compile the following code.  Create or use a sample datafeed document that is saved as "data.xml" in the output executable's directory.
  
 +You can get the sample XML for v0.7.2 from [[v:0.7.2:transaction_xml_datafeed|Transaction XML Datafeeds: Instant Transaction Notification]] or [[http://wiki.foxycart.com/v/0.7.2/transaction_xml_datafeed]]
 ===== Requirements ===== ===== Requirements =====
 Requires .Net Framework 2.0 or compatible.   Requires .Net Framework 2.0 or compatible.  
  
-===== Code =====+=====  
 +Code =====
 <code C#> <code C#>
 using System; using System;
Line 28: Line 36:
 using System.Net; using System.Net;
 using System.Text; using System.Text;
-using System.Web;   //Add reference to System.Net.dll+using System.Web;   //Add reference to System.Web.dll. Ensure target framework is the full.net framework, not a client profile (client profiles do not include System.Web)
  
 class Program class Program
 { {
  
-    private static string DataFeedKey = "[Your API key here]";+    private static string DataFeedKey = "[Your API key here, remove square brackets]";
  
     static void Main(string[] args)     static void Main(string[] args)
Line 49: Line 57:
  
         //Create a web request to send the data         //Create a web request to send the data
-        HttpWebRequest req = (HttpWebRequest)WebRequest.Create("[Your datafeed processing page here]");+        HttpWebRequest req = (HttpWebRequest)WebRequest.Create("[Your datafeed processing page here, remove square brackets]");
         req.Method = "POST";         req.Method = "POST";
         req.ContentType = "application/x-www-form-urlencoded";         req.ContentType = "application/x-www-form-urlencoded";
Line 238: Line 246:
  
 </code> </code>
- 
  

Site Tools