<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.method.me/cs/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Method:API Q&amp;A</title><link>http://forums.method.me/cs/forums/15.aspx</link><description>Ask questions specific to the MethodAPI from the Method Team and other Method users.</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 SP2 (Build: 31113.47)</generator><item><title>Re: Problems with Web Service API Call</title><link>http://forums.method.me/cs/forums/thread/12971.aspx</link><pubDate>Tue, 03 Jul 2012 18:48:28 GMT</pubDate><guid isPermaLink="false">3393c1ec-311b-4812-96cb-ad8c611bba4f:12971</guid><dc:creator>DaveS</dc:creator><slash:comments>0</slash:comments><comments>http://forums.method.me/cs/forums/thread/12971.aspx</comments><wfw:commentRss>http://forums.method.me/cs/forums/commentrss.aspx?SectionID=15&amp;PostID=12971</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi David&lt;/p&gt;
&lt;p&gt;Thank you for both of your replies on my Forum posting about problems with Web Service APIs calls.&amp;nbsp; Very helpful.&amp;nbsp; I have passed them on to my IT staff and we&amp;#39;ll follow your instructions and suggestions and try to get the problems resolved.&amp;nbsp;&amp;nbsp; I&amp;#39;ll let you know if I have other findings or questions.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; Dave Sakamoto&lt;/p&gt;</description></item><item><title>Re: Problems with Web Service API Call</title><link>http://forums.method.me/cs/forums/thread/12961.aspx</link><pubDate>Tue, 03 Jul 2012 14:41:43 GMT</pubDate><guid isPermaLink="false">3393c1ec-311b-4812-96cb-ad8c611bba4f:12961</guid><dc:creator>Method_David</dc:creator><slash:comments>0</slash:comments><comments>http://forums.method.me/cs/forums/thread/12961.aspx</comments><wfw:commentRss>http://forums.method.me/cs/forums/commentrss.aspx?SectionID=15&amp;PostID=12961</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;HI DaveS&lt;/p&gt;
&lt;p&gt;Following up a little more on this, we should also point out that we have no other users reporting this. We also use the API on a regular basis for many of our applications and internal functions and have never encountered this problem, nor have we had to resort to implementing Microsoft&amp;rsquo;s certificate policy code above.&amp;nbsp; So, while the above solution may work for you, the source of the problem may have been just a corrupt cache on your browser (out of our control), corrupt cache of certificates at your ISP or firewall level (out of our control), or a corrupt web reference by your app in visual studio (worth removing the reference entirely, and re-adding it from scratch with a new name).&lt;/p&gt;
&lt;p&gt;Dave&lt;/p&gt;</description></item><item><title>Re: Problems with Web Service API Call</title><link>http://forums.method.me/cs/forums/thread/12956.aspx</link><pubDate>Tue, 03 Jul 2012 13:39:43 GMT</pubDate><guid isPermaLink="false">3393c1ec-311b-4812-96cb-ad8c611bba4f:12956</guid><dc:creator>Method_David</dc:creator><slash:comments>0</slash:comments><comments>http://forums.method.me/cs/forums/thread/12956.aspx</comments><wfw:commentRss>http://forums.method.me/cs/forums/commentrss.aspx?SectionID=15&amp;PostID=12956</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi DaveS,&lt;/p&gt;
&lt;p&gt;&amp;quot;1 Method API documentation suggests using HTTPS, is that still true?&amp;quot;&lt;/p&gt;
&lt;p&gt;Yes&lt;/p&gt;
&lt;p&gt;&amp;quot;2. Is there a limit to the # of API calls such as 1000 per day/ week/ month?&amp;quot;&lt;/p&gt;
&lt;p&gt;No there is not....as long as your login credentials are valid use away&lt;/p&gt;
&lt;p&gt;&amp;quot;3. Why are the Method API calls not working and what can we do to get them to work reliably.&amp;quot;&lt;/p&gt;
&lt;p&gt;This one is a little trickier....what it comes down to is there may be a problem with your application&amp;nbsp;trusting our ssl certificate. When you browse the web and you get this issue you, you get a prompt asking you something like &amp;quot;Do you want to accept/trust the cert, etc.&amp;quot;. You&amp;nbsp;don&amp;#39;t get this prompt&amp;nbsp;in a webservice call. &lt;/p&gt;
&lt;p&gt;For this specific issue, what you need to do is create your own Certificate policy class that implements the ICertificatePolicy interface.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll post the examples from the following article &lt;a href="http://support.microsoft.com/kb/823177"&gt;http://support.microsoft.com/kb/823177&lt;/a&gt;&amp;nbsp;You can also find out more by doing a google search for &amp;quot;The underlying connection was closed: Could not establish trust relationship with remote server&amp;quot;&lt;/p&gt;
&lt;p&gt;VB&lt;/p&gt;
&lt;p&gt;Imports System.Net&lt;br /&gt;Imports System.Security.Cryptography.X509Certificates&lt;br /&gt;Public Class MyPolicy&lt;br /&gt;&amp;nbsp; Implements ICertificatePolicy&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Public Function CheckValidationResult(ByVal srvPoint As ServicePoint, _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ByVal cert As X509Certificate, ByVal request As WebRequest, _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ByVal certificateProblem As Integer) _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; As Boolean Implements ICertificatePolicy.CheckValidationResult&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;Return True to force the certificate to be accepted.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return True&lt;br /&gt;&amp;nbsp; End Function&lt;br /&gt;End Class&lt;/p&gt;
&lt;p&gt;C#&lt;/p&gt;
&lt;p&gt;using System.Net;&lt;br /&gt;using System.Security.Cryptography.X509Certificates;&lt;/p&gt;
&lt;p&gt;public class MyPolicy : ICertificatePolicy {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public bool CheckValidationResult(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ServicePoint srvPoint&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , X509Certificate certificate&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , WebRequest request&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , int certificateProblem) {&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Return True to force the certificate to be accepted.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return true;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } // end CheckValidationResult&lt;br /&gt;} // class MyPolicy&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Before the webservice call is invoked you need to execute the following&lt;/p&gt;
&lt;p&gt;VB&lt;/p&gt;
&lt;p&gt;System.Net.ServicePointManager.CertificatePolicy = New MyPolicy()&lt;/p&gt;
&lt;p&gt;C#&lt;/p&gt;
&lt;p&gt;System.Net.ServicePointManager.CertificatePolicy = new MyPolicy();&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Dave&lt;/p&gt;</description></item><item><title>Problems with Web Service API Call</title><link>http://forums.method.me/cs/forums/thread/12950.aspx</link><pubDate>Mon, 02 Jul 2012 22:53:56 GMT</pubDate><guid isPermaLink="false">3393c1ec-311b-4812-96cb-ad8c611bba4f:12950</guid><dc:creator>DaveS</dc:creator><slash:comments>0</slash:comments><comments>http://forums.method.me/cs/forums/thread/12950.aspx</comments><wfw:commentRss>http://forums.method.me/cs/forums/commentrss.aspx?SectionID=15&amp;PostID=12950</wfw:commentRss><description>&lt;p&gt;Our Method Integration API calls are not always working.&amp;nbsp;&amp;nbsp; It sometimes works for about 24 hours, then stops working.&amp;nbsp; It returns the following error message.&lt;/p&gt;
&lt;p&gt;&amp;quot;The underlying connection was closed: Could not establish trust relationship with remote server.The underlying connection was closed: Could not establish trust relationship with remote server.0Therre was an error with the methods API call.&amp;quot;&lt;br /&gt;&lt;br /&gt;We have used both HTTP and HTTPS, and one of the other sometimes work.&amp;nbsp; &lt;br /&gt;We are using Visual Studios 2005, ASP.Net&amp;nbsp; &lt;br /&gt;&lt;br /&gt;These are the urls we use to get to the&amp;nbsp;Web Services directory:&lt;br /&gt;&lt;span style="font-size:small;"&gt;&lt;a href="https://www.methodintegration.com/MethodAPI/service.asmx"&gt;https://www.methodintegration.com/MethodAPI/service.asmx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.methodintegration.com/MethodAPI/service.asmx"&gt;http://www.methodintegration.com/MethodAPI/service.asmx&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;The code that we use for the API calls are shown below.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:small;"&gt;&lt;br /&gt;Questions:&lt;br /&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp; Method API documentation suggests using HTTPS, is that still true?&lt;br /&gt;2.&amp;nbsp;&amp;nbsp; Is there a limit to the # of API calls such as 1000 per day/ week/ month?&lt;br /&gt;3.&amp;nbsp;&amp;nbsp;&amp;nbsp;Why are the Method API calls not working and what can we do to get them to work reliably.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dave&amp;nbsp; &lt;br /&gt;----------------------------------------
&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="color:black;"&gt;Dim wbsMethodAPI As New com.methodintegration.www.Service &amp;#39;MethodAPI.Service&lt;br /&gt;Dim sResult As String &amp;#39;tells us Success or error&lt;br /&gt;Dim datResponse As Data.DataSet = Nothing&lt;br /&gt;Dim sCompanyAccount As String&lt;br /&gt;Dim sUserName As String&lt;br /&gt;Dim sPassword As String&lt;br /&gt;sCompanyAccount = Session(&amp;quot;mlogon&amp;quot;)&lt;br /&gt;sUserName = Session(&amp;quot;muname&amp;quot;)&lt;br /&gt;sPassword = Session(&amp;quot;mpw&amp;quot;)&lt;br /&gt;Dim sSelectFields As String&lt;br /&gt;Dim sSelectFrom As String&lt;br /&gt;Dim sSelectWhere As String&lt;br /&gt;Dim sSelectGroupBy As String&lt;br /&gt;Dim sSelectHaving As String&lt;br /&gt;Dim sSelectOrderBy As String&lt;br /&gt;&lt;br /&gt;sSelectFields = &amp;quot;account,accounttxn,txntype,accountnumber,txnrecordid,ispostedtoaccounting,amount,txndate,txndetailrecordid&amp;quot;&lt;br /&gt;sSelectFrom = &amp;quot;transaction&amp;quot;&lt;br style="mso-special-character:line-break;" /&gt;&lt;br style="mso-special-character:line-break;" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin:0in 0in 0pt;"&gt;&lt;span style="color:black;"&gt;sSelectWhere = &amp;quot;account=&amp;#39;&amp;quot; &amp;amp; saccount &amp;amp; &amp;quot;&amp;#39; and ispostedtoaccounting =1 and txndate &amp;gt;= &amp;#39;&amp;quot; &amp;amp; Session(&amp;quot;Fstartdate&amp;quot;) &amp;amp; &amp;quot; 12:00:00 AM&amp;#39; and txndate &amp;lt;= &amp;#39;&amp;quot; &amp;amp; Session(&amp;quot;Ftodate&amp;quot;) &amp;amp; &amp;quot; 11:59:59 PM&amp;#39;&amp;quot;&lt;br /&gt;&amp;#39;txndate &amp;gt;= &amp;#39;&amp;quot; &amp;amp; mydate &amp;amp; &amp;quot; 12:00:00 AM&amp;#39; and txndate &amp;lt;= &amp;#39;&amp;quot; &amp;amp; mydate2 &amp;amp; &amp;quot; 11:59:59 PM&amp;#39;&amp;quot;&lt;br /&gt;&lt;br /&gt;sSelectGroupBy = &amp;quot;&amp;quot;&lt;br /&gt;sSelectHaving = &amp;quot;&amp;quot;&lt;br /&gt;sSelectOrderBy = &amp;quot;&amp;quot;&lt;br /&gt;&amp;#39;Call the MethodAPI to get the dataset&lt;br /&gt;sResult = wbsMethodAPI.MethodAPISelect_DataSet(sCompanyAccount, sUserName, sPassword, _&lt;br /&gt;datResponse, sSelectFrom, sSelectFields, sSelectWhere, sSelectGroupBy, sSelectHaving, sSelectOrderBy)&lt;br /&gt;wbsMethodAPI = Nothing&lt;br /&gt;If sResult.Trim.ToUpper.StartsWith(&amp;quot;Success&amp;quot;.ToUpper) = False Then&lt;br /&gt;&amp;#39;failed, give a message&lt;br /&gt;Response.Write(sResult)&lt;br /&gt;merror = 1&lt;br /&gt;Exit Sub&lt;br /&gt;End If&lt;/span&gt;&lt;/p&gt;
&lt;font size="3"&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>