I'm hosting a magento webshop on my local machine using IIS 7.5 and PHP 5.6 (testing). The shop is working just fine, but now I want to create a separate application using visual studio 2013. These are the steps that I've taken:
- I've added the domain name "www.domain.com.local" to my hosts file directing to my localhost (www.domain.com.local -> 127.0.0.1)
- I've created a new website on my IIS and added a new binding (www.domain.com.local - see 1)
- I've added WinCache extension with the PHP Manager and set the PHP version to 5.6
- Enable WS-I Compliance in the magento backend (System > Configuration > Magento Core Api)
- Create a SOAP Role and User (Resource Access = All)
- Open visual studio 2013 and create a new Console Application
- Adding a new Service Reference (http://www.domain.com.local/index.php/api/v2_soap/?wsdl)
- Trying to login - This is not working like it should be
Here is my piece of code:
class Program
{
static void Main(string[] args)
{
MainAsync(args).Wait();
}
static async Task MainAsync(string[] args)
{
using (var proxy = new Mage_Api_Model_Server_Wsi_HandlerPortTypeClient())
{
try
{
var loginResponse = await proxy.loginAsync("soap-admin", "xxxxxxxxx"); // api key
var sessionId = loginResponse.result;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.ReadLine();
}
}
}
And this is the error I'm getting:
The content type text/xml; charset=utf-8,text/xml; charset=utf-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 297 bytes of the response were: '<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Magento">
<SOAP-ENV:Body>
<ns1:loginResponseParam>
<result>13fa067676759c3ce8ddd61c386b6d5c</result>
</ns1:loginResponseParam>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
'.
So as you can see, I'm getting my sessionId but keep getting this error. I've also used fiddler to investigate and getting a correct response: HTTP 200 OK. Does someone knows what the problem could be? Is it IIS related? localhost related?
(When I add the url as web reference it works just fine - old webservice method).
Related topics I've read and tried (without success):