web-services - SOAP-ERROR : Encoding: string . .. 不是有效的 utf-8 字符串

标签 web-services zend-framework soap encoding

嗨,我有一个使用 Zend 框架构建的 Web 服务。其中一种方法旨在发送有关订单的详细信息。我遇到了一些编码问题。返回的值之一包含以下内容:

Jaime Torres Bodet #322-A Col. Lomas de Santa María

Web 服务返回以下错误:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
         <faultcode>SOAP-ENV:Server</faultcode>
         <faultstring>SOAP-ERROR: Encoding: string 'Jaime Torres Bodet #322-A Col. Lomas de Santa Mar\xc3...' is not a valid utf-8 string</faultstring>
      </SOAP-ENV:Fault>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

我该如何解决这个问题?

谢谢

后续:问题是由于数据库截断了字符串。该字段被设置为 VARCHAR(50) 并且它恰好在编码值的中间被截断。

最佳答案

更改编码设置怎么样:

服务器:

$server = new SoapServer("some.wsdl", array('encoding'=>'ISO-8859-1')); // for 'windows-1252' too

客户:
$server = new SoapClient("some.wsdl", array('encoding'=>'ISO-8859-1')); // for 'windows-1252' too

...然后自动完成转换为UTF-8,我遇到了类似的问题,所以这对我有帮助,因此对其进行了测试

关于web-services - SOAP-ERROR : Encoding: string . .. 不是有效的 utf-8 字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8006274/

相关文章:

ios - 更新到XE2 Update 2后,Delphi/FPC代码不再在XCode下编译

java - 在 Soap Web 服务响应中获取 Json 数据

python - uwsgi + nginx + pypy Web 服务基准测试

zend-framework - Zend Framework : How and where to create custom routes in a 1. 8+ 应用程序?

zend-framework - 仅渲染 <form> 标签

soap - 在哪里可以找到 gSOAP 生成的 WSDL 文件

c# - 返回列表而不是项目 Webservice Phone 8.1 UAP

php - Zend Form Radio 多选项标题属性

java - Apache CXF java2wsdl : Custom symbol names

java - 将 SOAP 转换为虚拟 Restful 服务?