0

In my first magento to api connection (SOAP) programme it says that it has ProtocolException was handheld by user code. Here is the full exception error

----------------------------ERROR---------------------------------------------------------

System.ServiceModel.ProtocolException was unhandled HResult=-2146233087 Message=The content type text/html; 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 361 bytes of the response were: ' 0 SOAP extension is not loaded. '. Source=mscorlib StackTrace: Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory1 factory, WebException responseException, ChannelBinding channelBinding) at System.ServiceModel.Channels.HttpChannelFactory1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at SOAPTesting.ServiceReference2.Mage_Api_Model_Server_V2_HandlerPortType.login(String username, String apiKey) at SOAPTesting.ServiceReference2.Mage_Api_Model_Server_V2_HandlerPortTypeClient.login(String username, String apiKey) in g:\VISUAL STUDIO 2013 PROJECT WORKSPACE\HarshiniPROJECT\SOAPTesting\SOAPTesting\Service References\ServiceReference2\Reference.cs:line 29488 at SOAPTesting.Program.Main(String[] args) in g:\VISUAL STUDIO 2013 PROJECT WORKSPACE\HarshiniPROJECT\SOAPTesting\SOAPTesting\Program.cs:line 16 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:

------------------ CODING--------------------------------------------------------------

     public static void Main(string[] args)
    {
        Mage_Api_Model_Server_V2_HandlerPortTypeClient mservice = new Mage_Api_Model_Server_V2_HandlerPortTypeClient();
        string mlogin = mservice.login("dileepa", "takastakas");

        Debug.WriteLine(mlogin);
        filters mf = new filters();
        complexFilter[] cpf = new complexFilter[1];
        complexFilter mcpf = new complexFilter();
        mcpf.key = "increment_id";
        associativeEntity mas = new associativeEntity();
        mas.key = "gt";
        mas.value = "1008001";
        mcpf.value = mas;
        cpf[0] = mcpf;
        mf.complex_filter = cpf;
        salesOrderListEntity[] soe = mservice.salesOrderList(mlogin, mf);
        if (soe.Length > 0)
        {

            foreach (salesOrderListEntity msoe in soe)
            {
                try
                {
                    Debug.WriteLine("" + msoe.billing_firstname + " " + msoe.subtotal);
                }
                catch (Exception merror)
                {
                  Console.WriteLine("" + msoe.order_id + "" + merror.ToString());
                }
            }
        }



        Console.ReadLine();

    }
0

SOAP extension is not loaded.

That should give you an idea. The server where your magento instance is placed is missing the php_soap extension.
enable it and it should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.