cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to authenticate magento Api(V2) Using C#. Always facing these error “Session expired. Try to

Unable to authenticate magento Api(V2) Using C#. Always facing these error “Session expired. Try to

I am trying to download order from web server using magento soap API(v2). but i am unable to authenticate with magento web server. I have removed all service reference and reinstalled service reference like "http://example.com/api/v2_soap?wsdl" but facing same issue "Session expired. Try to re login.". Also I have created new project and run the same code. Then i have successfully authenticate with magento website with magento API(V2) and return session id. Also I have cleaned the whole solution and build it, Then facing same issue "Session expired. Try to re login.". My code snepad are given bellow

try
{
_apiUrl = magento.MagentoHostName + "/index.php/api/v2_soap/index";
userName = magento.MagentoUserName;
apiKey = magento.MagentoApiKey;

string endpointURL = _apiUrl;
string endpointConfigurationName = "Port";
MagentoService.PortTypeClient service = new MagentoService.PortTypeClient();

var session = service.login(userName, apiKey);
}

catch (Exception e)
{
r = ErrorHandler.CustomizeError(e, r);
}