C#+ Magento API V2:内容类型text / xml;字符集= UTF-8,文本/ XML; charset =响应消息的UTF-8不匹配

时间:2013-12-15 06:25:58

标签: magento soap

我正在开发一个项目,使用C#[MVC4.5]从Magento网站[V1.5.1]下载订单列表, 在我开始之前,我从www服务器构建了一个开发服务器副本集成文件,我的程序在dev服务器上运行得很好。之后,我将webservice引用[http://dev.example.com/index.php/api/v2_soap/?wsdl]更改为[http://www.example.com/index.php/api/v2_soap/?wsdl],then我得到了错误信息如下:

  '/'应用程序中的服务器错误。

     

内容类型text / xml;字符集= UTF-8,文本/ XML; charset = UTF-8   响应消息与绑定的内容类型不匹配   (text / xml; charset = utf-8)。如果使用自定义编码器,请确保   IsContentTypeSupported方法正确实现。第566号   响应的字节是:“?xml version =”1.0“encoding =”UTF-8“?”   “SOAP-ENV:信封   的xmlns:SOAP-ENV = “http://schemas.xmlsoap.org/soap/envelope/”   xmlns:ns1 =“urn:Magento”xmlns:xsd =“http://www.w3.org/2001/XMLSchema”   的xmlns:的xsi = “http://www.w3.org/2001/XMLSchema-instance”   的xmlns:SOAP-ENC = “http://schemas.xmlsoap.org/soap/encoding/”   SOAP-ENV:的encodingStyle = “http://schemas.xmlsoap.org/soap/encoding/”“”SOAP-ENV:身体“”NS1:startSessionResponse“”startSessionReturn   的xsi:type = “XSD:字符串”“的 fe4d182c95add56efba2191ed9d4dddb ”/ startSessionReturn>“中/ NS1:startSessionResponse>”中/ SOAP-ENV:身体“”/ SOAP-ENV:信封“

以下是响应标题信息:

WWW Server
HTTP/1.1 500 Internal Server Error
Cache-Control: private
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/8.0
X-AspNet-Version: 4.0.30319
X-SourceFiles: =?UTF-8?B?RTpcTkVUNC41XFByb2R1Y2VNYW5hZ2VtZW50XFByb2R1Y2VNYW5hZ2VtZW50?=
X-Powered-By: ASP.NET
Date: Mon, 16 Dec 2013 17:09:20 GMT
Content-Length: 17079


Develop Server:
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Encoding: gzip
Vary: Accept-Encoding
Server: Microsoft-IIS/8.0## Heading ##
Set-Cookie: .ASPXAUTH=********; path=/; HttpOnly
X-AspNetMvc-Version: 4.0
X-AspNet-Version: 4.0.30319
X-SourceFiles: =?UTF-8?B?RTpcTkVUNC41XFByb2R1Y2VNYW5hZ2VtZW50XFByb2R1Y2VNYW5hZ2VtZW50?=
X-Powered-By: ASP.NET
Date: Mon, 16 Dec 2013 17:29:36 GMT
Content-Length: 3789

By the way,i tried to change php file Soap.php:
->setHeader('Content-Type','text/xml; charset='.$apiConfigCharset, true);
 but didn't work for me .....

如果有人能提供帮助,我非常感谢,谢谢......

2 个答案:

答案 0 :(得分:2)

Magento堆栈中出现了类似的问题。我在那里回答,见:https://magento.stackexchange.com/questions/42536/problems-calling-magento-soap-v2-service-in-c/43046#43046

答案 1 :(得分:-1)

使用XML rpc API。它被称为ez时事通讯。您需要创建一个具有访问权限http://jmawebtechnologies.com/support/quickbooks/magento-cloud-cart-connector-installation

的API用户