<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: GetTransactionDetails XML web service call sample in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/GetTransactionDetails-XML-web-service-call-sample/m-p/49319#M24904</link>
    <description>&lt;P&gt;It as simple as sending it as a string.&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://stackoverflow.com/questions/1228976/xdocument-tostring-drops-xml-encoding-tag"&gt;http://stackoverflow.com/questions/1228976/xdocument-tostring-drops-xml-encoding-tag&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Jan 2015 23:54:51 GMT</pubDate>
    <dc:creator>RaynorC1emen7</dc:creator>
    <dc:date>2015-01-13T23:54:51Z</dc:date>
    <item>
      <title>GetTransactionDetails XML web service call sample</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/GetTransactionDetails-XML-web-service-call-sample/m-p/49316#M24901</link>
      <description>&lt;P&gt;I have reviewed the XML sample code, and wanted to know if there was any C# sample code to actually make the call (HTTP POST).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" title="New API Call -- getTransactionDetails" href="https://community.developer.cybersource.com/t5/News-and-Announcements/New-API-Call-getTransactionDetails/m-p/5962/highlight/true#M53"&gt;http://community.developer.authorize.net/t5/News-and-Announcements/New-API-Call-getTransactionDetails/m-p/5962/highlight/true#M53&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the XML that I want to send:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;getTransactionDetailsRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"&amp;gt;
  &amp;lt;merchantAuthentication&amp;gt;
    &amp;lt;name&amp;gt;YourUserLogin&amp;lt;/name&amp;gt;
    &amp;lt;transactionKey&amp;gt;YourTranKey&amp;lt;/transactionKey&amp;gt;
  &amp;lt;/merchantAuthentication&amp;gt;
  &amp;lt;transId&amp;gt;1111111111&amp;lt;/transId&amp;gt;
&amp;lt;/getTransactionDetailsRequest&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So in other words, how do I package and send this code in my C# web application.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jan 2015 18:31:09 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/GetTransactionDetails-XML-web-service-call-sample/m-p/49316#M24901</guid>
      <dc:creator>pzozulka6200</dc:creator>
      <dc:date>2015-01-13T18:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: GetTransactionDetails XML web service call sample</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/GetTransactionDetails-XML-web-service-call-sample/m-p/49317#M24902</link>
      <description>&lt;P&gt;You mean how to do xml call in c#?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://developer.authorize.net/downloads/samplecode/"&gt;http://developer.authorize.net/downloads/samplecode/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://developer.authorize.net/resources/files/samplecode/csharp_cim.zip"&gt;CIM - C#&lt;/A&gt;&lt;/P&gt;&lt;P&gt;have example on how to do xml call.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jan 2015 22:12:28 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/GetTransactionDetails-XML-web-service-call-sample/m-p/49317#M24902</guid>
      <dc:creator>RaynorC1emen7</dc:creator>
      <dc:date>2015-01-13T22:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: GetTransactionDetails XML web service call sample</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/GetTransactionDetails-XML-web-service-call-sample/m-p/49318#M24903</link>
      <description>&lt;P&gt;It seems to show good examples of how to process the XML response, but not seeing any sample code on how to take a piece of existing XML code, and send it as a request. For example, PostRequest&amp;nbsp;method takes ApiRequest of type Object as one of it's parameters, and then serializes it . I'm new to C# so I'm not sure how serializer works, and whether it really matters in this situation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure how to process a XDocument using PostRequest or similar.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jan 2015 23:12:32 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/GetTransactionDetails-XML-web-service-call-sample/m-p/49318#M24903</guid>
      <dc:creator>pzozulka6200</dc:creator>
      <dc:date>2015-01-13T23:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: GetTransactionDetails XML web service call sample</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/GetTransactionDetails-XML-web-service-call-sample/m-p/49319#M24904</link>
      <description>&lt;P&gt;It as simple as sending it as a string.&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://stackoverflow.com/questions/1228976/xdocument-tostring-drops-xml-encoding-tag"&gt;http://stackoverflow.com/questions/1228976/xdocument-tostring-drops-xml-encoding-tag&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jan 2015 23:54:51 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/GetTransactionDetails-XML-web-service-call-sample/m-p/49319#M24904</guid>
      <dc:creator>RaynorC1emen7</dc:creator>
      <dc:date>2015-01-13T23:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: GetTransactionDetails XML web service call sample</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/GetTransactionDetails-XML-web-service-call-sample/m-p/49320#M24905</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thanks much. Just to make sure, would the following be correct:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;public const String API_URL = "&lt;A target="_blank" href="https://apitest.authorize.net/xml/v1/request.api&amp;quot;;"&gt;https://apitest.authorize.net/xml/v1/request.api";&lt;/A&gt;

public static void Main()
{
    XNamespace ns = "AnetApi/xml/v1/schema/AnetApiSchema.xsd";

            XDocument doc = new XDocument(
                    new XElement(ns + "getTransactionDetailsRequest",
                        new XAttribute("xmlns", "AnetApi/xml/v1/schema/AnetApiSchema.xsd"),
                    new XElement(ns + "merchantAuthentication",
                        new XElement(ns + "name", TEST_NAME),
                        new XElement(ns + "transactionKey", TEST_TRANS_KEY)),
                    new XElement(ns + "transId", TEST_TRANS_ID))
                    );

    System.Xml.XmlDocument response_xml = null;
    PostRequest(doc.ToString(), out response_xml);
}

		public static bool PostRequest(object ApiRequest, out XmlDocument xmldoc)
		{
			bool bResult = false;
			XmlSerializer serializer;

			xmldoc = null;

			try
			{
				HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(API_URL);
				webRequest.Method = "POST";
				webRequest.ContentType = "text/xml";
				webRequest.KeepAlive = true;

				// Serialize the request
				serializer = new XmlSerializer(ApiRequest.GetType());
				XmlWriter writer = new XmlTextWriter(webRequest.GetRequestStream(), Encoding.UTF8);
				serializer.Serialize(writer, ApiRequest);
				writer.Close();

				if (PRINT_POST)
				{
					Console.WriteLine("\r\n\r\n");
					StreamWriter consoleOutput = new StreamWriter(Console.OpenStandardOutput());
					consoleOutput.AutoFlush = true;
					serializer.Serialize(consoleOutput, ApiRequest);
					consoleOutput.Close();
					Console.WriteLine("\r\n\r\n");
				}

				// Get the response
				WebResponse webResponse = webRequest.GetResponse();

				// Load the response from the API server into an XmlDocument.
				xmldoc = new XmlDocument();
				xmldoc.Load(XmlReader.Create(webResponse.GetResponseStream()));

				if (PRINT_POST)
				{
					XmlWriterSettings settings = new XmlWriterSettings();
					settings.Indent = true;
					settings.Encoding = Encoding.ASCII;
					XmlWriter consoleWriter = XmlWriter.Create(Console.Out, settings);
					xmldoc.WriteTo(consoleWriter);
					consoleWriter.Close();
					Console.WriteLine("\r\n\r\n");
				}

				bResult = true;
			}
			catch (Exception ex)
			{
				Console.WriteLine(ex.GetType().ToString() + ": " + ex.Message);
				bResult = false;
			}

			return bResult;
		}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jan 2015 00:07:42 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/GetTransactionDetails-XML-web-service-call-sample/m-p/49320#M24905</guid>
      <dc:creator>pzozulka6200</dc:creator>
      <dc:date>2015-01-14T00:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: GetTransactionDetails XML web service call sample</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/GetTransactionDetails-XML-web-service-call-sample/m-p/49323#M24908</link>
      <description>&lt;P&gt;Try it and debug it.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jan 2015 12:20:30 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/GetTransactionDetails-XML-web-service-call-sample/m-p/49323#M24908</guid>
      <dc:creator>RaynorC1emen7</dc:creator>
      <dc:date>2015-01-14T12:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: GetTransactionDetails XML web service call sample</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/GetTransactionDetails-XML-web-service-call-sample/m-p/49324#M24909</link>
      <description>&lt;P&gt;Since I'm not familiar with serializer, I modified the PostRequest method in the API to meet my needs. It seems like I am getting the response from Authorize.NET, and can see some XML, but I am having trouble capturing the &lt;STRONG&gt;responseReasonCode&lt;/STRONG&gt; node's value (or for that matter -- I can't even get the node as it says it is NULL in the code below).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;            XNamespace ns = "AnetApi/xml/v1/schema/AnetApiSchema.xsd";

            XDocument doc = new XDocument(
                    new XElement(ns + "getTransactionDetailsRequest",
                        new XAttribute("xmlns", "AnetApi/xml/v1/schema/AnetApiSchema.xsd"),
                    new XElement(ns + "merchantAuthentication",
                        new XElement(ns + "name", TEST_NAME),
                        new XElement(ns + "transactionKey", TEST_TRANS_KEY)),
                    new XElement(ns + "transId", TEST_TRANS_ID))
                    );

            MemoryStream stream = new MemoryStream();
            doc.Save(stream);
            byte[] postBytes = new byte[stream.Length];
            stream.Seek(0, SeekOrigin.Begin);
            stream.Read(postBytes, 0, postBytes.Length);
            

            WebClient WC = new WebClient();
            ServicePointManager.ServerCertificateValidationCallback = TrustAllCertificateCallback;
            HttpWebRequest wrequest = (HttpWebRequest)WebRequest.Create(IsLive ? LIVE_URL : TEST_URL);
            wrequest.Timeout = 300000;
            wrequest.Method = "POST";
            wrequest.ContentType = "text/xml";
            wrequest.ContentLength = stream.Length;

            Stream lilriver = wrequest.GetRequestStream();
            lilriver.Write(postBytes, 0, postBytes.Length);

            WebResponse webResponse = wrequest.GetResponse();

            XDocument xdoc = XDocument.Load(XmlReader.Create(webResponse.GetResponseStream()));
            //var node = xdoc.Descendants().Where(n =&amp;gt; n.Name == "responseReasonCode").FirstOrDefault();
            var node = xdoc.Descendants("responseReasonCode").FirstOrDefault();

            if (node != null)
            {
                reason = node.Value;
            }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jan 2015 16:35:07 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/GetTransactionDetails-XML-web-service-call-sample/m-p/49324#M24909</guid>
      <dc:creator>pzozulka6200</dc:creator>
      <dc:date>2015-01-14T16:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: GetTransactionDetails XML web service call sample</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/GetTransactionDetails-XML-web-service-call-sample/m-p/49325#M24910</link>
      <description>&lt;P&gt;Why not just use the soap/web service? then you don't have to deal with xml at all.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jan 2015 17:09:55 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/GetTransactionDetails-XML-web-service-call-sample/m-p/49325#M24910</guid>
      <dc:creator>RaynorC1emen7</dc:creator>
      <dc:date>2015-01-14T17:09:55Z</dc:date>
    </item>
  </channel>
</rss>

