How to use the WepAPI


https://forum.kartris.com/Topic2524.aspx
Print Topic | Close Window

By Boxson - Fri 25 Oct 2013
Hi all,

i'm trying to use the WebAPI. I wrote a small C# Application which connects to the WebAPI to read categories and write new categories to kartris.

I'm stuck with the Execute Method. I always recieve an error from Web API telling me that the method called could not be found in class. If i open the Class File i see there are the methods and they are called with the right name.


string WSresult = WSClient.Execute("LoginsBLL.GetDetails", "<Parameter Name=\"UserName\" Type=\"String\" Value=\"[email protected]\"/>");
MessageBox.Show(WSresult);


returns


<?xml version="1.0" encoding="utf-16"?>
<string>Error parsing method string! Exception Details -&gt; Can't find method "Getdetails" in Class "LoginsBLL"</string>


Any Idea whats wrong? Authetication is working right, if i change the token i get a message telling me authentication is wrong.
By Medz - Fri 25 Oct 2013
The strMethodName parameter is case sensitive. Make sure you're passing method "LoginsBLL.GetDetails" and not "LoginsBLL.Getdetails. Also the UserName parameter there should be the backend login username. It seems like you're passing the email address instead.
By Boxson - Fri 25 Oct 2013
string WSresult = WSClient.Execute("LoginsBLL.GetDetails", "<Parameter Name=\"UserName\" Type=\"String\" Value=\"Admin\"/>");


is showing the same result. The Error is telling that the Method "GetDetails" could not be found in Class LoginsBLL.

Any other hint?
By Medz - Fri 25 Oct 2013
Can you let me know which Kartris version are you using? Also the parameter string looks incorrect. It should be ->

 "<Parameter Name=\"UserName\" Type=\"String\"><Value>Admin</Value></Parameter>"
By Boxson - Mon 28 Oct 2013
I'm using latest version (2.5005). I've changed the "Value"-Part in XML and now it's working.
Thanks for your help!!
By Medz - Mon 28 Oct 2013
That great! Can you please mark my previous post as 'solution' so it's easier for other users to find it in future? Thanks.