<?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 HttpXMLUtility.CheckForErrors Method in the C# Library doesn't parse Response Correctly in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/HttpXMLUtility-CheckForErrors-Method-in-the-C-Library-doesn-t/m-p/50524#M25961</link>
    <description>&lt;P&gt;I've been working with the .Net SDK for Authorize.Net API from GitHub (version 1.8.3) and it seems that the CheckForErrors method in HttpXMLUtility is returning the incorrect response.&amp;nbsp; It seemed as if the response was being altered and the response parameters like AuthCode and ResponseCode are missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is being called from HttpXMLUtility.Send whether I do an Auth or a Capture.&amp;nbsp; Both cases don't return an AuthCode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In debugging it looks like the XML Response has 2 Child.Child level nodes.&amp;nbsp; One is "messages" and the other is "directReponse".&amp;nbsp; The way it is coded messages is the first Child.Child node, so it sets thingy.directReponse to the message and it never grabs the directReponse. (See current code below)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        void CheckForErrors(ANetApiResponse response) {

            if (response.GetType() == typeof(createCustomerProfileTransactionResponse)) {
                //there's a directResponse we need to find...
                var thingy = (createCustomerProfileTransactionResponse)response;
                &lt;FONT color="#000000"&gt;thingy.directResponse = null;&lt;/FONT&gt;
                for (var i = 0; i &amp;lt;= 1; i++)
                {
                    if (null != _xmlDoc &amp;amp;&amp;amp; null != _xmlDoc.ChildNodes[i])
                    {
                        for (var j = 0; j &amp;lt;= 1; j++)
                        {
&lt;FONT color="#FF0000"&gt;                            if (null != _xmlDoc.ChildNodes[i].ChildNodes[j])
                            {
                                thingy.directResponse = _xmlDoc.ChildNodes[i].ChildNodes[j].InnerText;
                            }&lt;/FONT&gt;
                            if (null != thingy.directResponse) { break; }
                        }
                    }
                    if (null != thingy.directResponse) { break; }
                }
                response = thingy;
            } else {

                if (response.messages.message.Length &amp;gt; 0) {

                    if (response.messages.resultCode == messageTypeEnum.Error) {
                        StringBuilder sb = new StringBuilder();
                        for (int i = 0; i &amp;lt; response.messages.message.Length; i++) {
                            sb.AppendFormat("Error processing request: {0} - {1}", response.messages.message[i].code, response.messages.message[i].text);
                        }
                        throw new InvalidOperationException(sb.ToString());
                    }

                }
            }
        }&lt;/PRE&gt;&lt;P&gt;Should this inner look not be checking specifically for the directReponse node if there are more than one Child.Child node?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps it should be modified as so:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        void CheckForErrors(ANetApiResponse response) {

            if (response.GetType() == typeof(createCustomerProfileTransactionResponse)) {
                //there's a directResponse we need to find...
                var thingy = (createCustomerProfileTransactionResponse)response;
                thingy.directResponse = null;
                for (var i = 0; i &amp;lt;= 1; i++)
                {
                    if (null != _xmlDoc &amp;amp;&amp;amp; null != _xmlDoc.ChildNodes[i])
                    {
                        for (var j = 0; j &amp;lt;= 1; j++)
                        {
                            &lt;FONT color="#FF0000"&gt;if (null != _xmlDoc.ChildNodes[i].ChildNodes[j])
                            {
                                if (_xmlDoc.ChildNodes[i].ChildNodes[j].Name == "directResponse")
                                {
                                    thingy.directResponse = _xmlDoc.ChildNodes[i].ChildNodes[j].InnerText;
                                }
                            }&lt;/FONT&gt;
                            if (null != thingy.directResponse) { break; }
                        }
                    }
                    if (null != thingy.directResponse) { break; }
                }
                response = thingy;
            } else {

                if (response.messages.message.Length &amp;gt; 0) {

                    if (response.messages.resultCode == messageTypeEnum.Error) {
                        StringBuilder sb = new StringBuilder();
                        for (int i = 0; i &amp;lt; response.messages.message.Length; i++) {
                            sb.AppendFormat("Error processing request: {0} - {1}", response.messages.message[i].code, response.messages.message[i].text);
                        }
                        throw new InvalidOperationException(sb.ToString());
                    }

                }
            }
        }&lt;/PRE&gt;&lt;P&gt;Looking to get some feedback in case I'm not on the right track.&lt;/P&gt;</description>
    <pubDate>Fri, 01 May 2015 19:30:58 GMT</pubDate>
    <dc:creator>JerseyTechGuy</dc:creator>
    <dc:date>2015-05-01T19:30:58Z</dc:date>
    <item>
      <title>HttpXMLUtility.CheckForErrors Method in the C# Library doesn't parse Response Correctly</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/HttpXMLUtility-CheckForErrors-Method-in-the-C-Library-doesn-t/m-p/50524#M25961</link>
      <description>&lt;P&gt;I've been working with the .Net SDK for Authorize.Net API from GitHub (version 1.8.3) and it seems that the CheckForErrors method in HttpXMLUtility is returning the incorrect response.&amp;nbsp; It seemed as if the response was being altered and the response parameters like AuthCode and ResponseCode are missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is being called from HttpXMLUtility.Send whether I do an Auth or a Capture.&amp;nbsp; Both cases don't return an AuthCode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In debugging it looks like the XML Response has 2 Child.Child level nodes.&amp;nbsp; One is "messages" and the other is "directReponse".&amp;nbsp; The way it is coded messages is the first Child.Child node, so it sets thingy.directReponse to the message and it never grabs the directReponse. (See current code below)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        void CheckForErrors(ANetApiResponse response) {

            if (response.GetType() == typeof(createCustomerProfileTransactionResponse)) {
                //there's a directResponse we need to find...
                var thingy = (createCustomerProfileTransactionResponse)response;
                &lt;FONT color="#000000"&gt;thingy.directResponse = null;&lt;/FONT&gt;
                for (var i = 0; i &amp;lt;= 1; i++)
                {
                    if (null != _xmlDoc &amp;amp;&amp;amp; null != _xmlDoc.ChildNodes[i])
                    {
                        for (var j = 0; j &amp;lt;= 1; j++)
                        {
&lt;FONT color="#FF0000"&gt;                            if (null != _xmlDoc.ChildNodes[i].ChildNodes[j])
                            {
                                thingy.directResponse = _xmlDoc.ChildNodes[i].ChildNodes[j].InnerText;
                            }&lt;/FONT&gt;
                            if (null != thingy.directResponse) { break; }
                        }
                    }
                    if (null != thingy.directResponse) { break; }
                }
                response = thingy;
            } else {

                if (response.messages.message.Length &amp;gt; 0) {

                    if (response.messages.resultCode == messageTypeEnum.Error) {
                        StringBuilder sb = new StringBuilder();
                        for (int i = 0; i &amp;lt; response.messages.message.Length; i++) {
                            sb.AppendFormat("Error processing request: {0} - {1}", response.messages.message[i].code, response.messages.message[i].text);
                        }
                        throw new InvalidOperationException(sb.ToString());
                    }

                }
            }
        }&lt;/PRE&gt;&lt;P&gt;Should this inner look not be checking specifically for the directReponse node if there are more than one Child.Child node?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps it should be modified as so:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        void CheckForErrors(ANetApiResponse response) {

            if (response.GetType() == typeof(createCustomerProfileTransactionResponse)) {
                //there's a directResponse we need to find...
                var thingy = (createCustomerProfileTransactionResponse)response;
                thingy.directResponse = null;
                for (var i = 0; i &amp;lt;= 1; i++)
                {
                    if (null != _xmlDoc &amp;amp;&amp;amp; null != _xmlDoc.ChildNodes[i])
                    {
                        for (var j = 0; j &amp;lt;= 1; j++)
                        {
                            &lt;FONT color="#FF0000"&gt;if (null != _xmlDoc.ChildNodes[i].ChildNodes[j])
                            {
                                if (_xmlDoc.ChildNodes[i].ChildNodes[j].Name == "directResponse")
                                {
                                    thingy.directResponse = _xmlDoc.ChildNodes[i].ChildNodes[j].InnerText;
                                }
                            }&lt;/FONT&gt;
                            if (null != thingy.directResponse) { break; }
                        }
                    }
                    if (null != thingy.directResponse) { break; }
                }
                response = thingy;
            } else {

                if (response.messages.message.Length &amp;gt; 0) {

                    if (response.messages.resultCode == messageTypeEnum.Error) {
                        StringBuilder sb = new StringBuilder();
                        for (int i = 0; i &amp;lt; response.messages.message.Length; i++) {
                            sb.AppendFormat("Error processing request: {0} - {1}", response.messages.message[i].code, response.messages.message[i].text);
                        }
                        throw new InvalidOperationException(sb.ToString());
                    }

                }
            }
        }&lt;/PRE&gt;&lt;P&gt;Looking to get some feedback in case I'm not on the right track.&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2015 19:30:58 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/HttpXMLUtility-CheckForErrors-Method-in-the-C-Library-doesn-t/m-p/50524#M25961</guid>
      <dc:creator>JerseyTechGuy</dc:creator>
      <dc:date>2015-05-01T19:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: HttpXMLUtility.CheckForErrors Method in the C# Library doesn't parse Response Correctly</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/HttpXMLUtility-CheckForErrors-Method-in-the-C-Library-doesn-t/m-p/50525#M25962</link>
      <description>&lt;P&gt;Thanks for reporting this. &amp;nbsp;I see you also &lt;A href="https://github.com/AuthorizeNet/sdk-dotnet/issues/83" target="_self"&gt;submitted the issue on GitHub&lt;/A&gt;&amp;nbsp;and one of our developers confirmed a solution will be included in an upcoming release.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Richard&lt;/P&gt;</description>
      <pubDate>Fri, 01 May 2015 20:41:46 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/HttpXMLUtility-CheckForErrors-Method-in-the-C-Library-doesn-t/m-p/50525#M25962</guid>
      <dc:creator>RichardH</dc:creator>
      <dc:date>2015-05-01T20:41:46Z</dc:date>
    </item>
  </channel>
</rss>

