C#+ Magento API V2:内容类型为text/xml; charset = utf-8,text/xml;响应消息的charset = UTF-8不匹配 [英] C#+Magento API V2:The content type text/xml; charset=utf-8,text/xml; charset=UTF-8 of the response message does not match

查看:188
本文介绍了C#+ Magento API V2:内容类型为text/xml; charset = utf-8,text/xml;响应消息的charset = UTF-8不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm developing a project to download the order list from Magento website[V1.5.1] using C#[MVC4.5], Before i start,i builded a dev server copy integral files from www server,and my program running very well on dev server.After that,i changed the webservice reference[http://dev.example.com/index.php/api/v2_soap/?wsdl] to [http://www.example.com/index.php/api/v2_soap/?wsdl],then i got the error message as below:

"/"应用程序中的服务器错误.

Server Error in '/' Application.

内容类型为text/xml; charset = utf-8,text/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:Body》《 ns1:startSessionResponse》《 startSessionReturn xsi:type ="xsd:string"》 fe4d182c95add56efba2191ed9d4dddb 《/startSessionReturn>》//ns1:startSessionResponse>《/SOAP-ENV:Body》《/SOAP-ENV:Envelope》

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 566 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" 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:Body》《ns1:startSessionResponse》《startSessionReturn xsi:type="xsd:string"》fe4d182c95add56efba2191ed9d4dddb《/startSessionReturn>《/ns1:startSessionResponse>《/SOAP-ENV:Body》《/SOAP-ENV:Envelope》

这是响应标题信息:

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 .....

非常感谢任何人的帮助,谢谢....

I'm very appreciate if anybody can help,thanks....

推荐答案

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

A similar question came up in the Magento stack. I answered it there, see: https://magento.stackexchange.com/questions/42536/problems-calling-magento-soap-v2-service-in-c/43046#43046

这篇关于C#+ Magento API V2:内容类型为text/xml; charset = utf-8,text/xml;响应消息的charset = UTF-8不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆