php soap客户端中的特殊字符的问题 [英] Problems with special characters in php soap client

查看:220
本文介绍了php soap客户端中的特殊字符的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有与这个问题。我有一个web服务(也使用php)返回一些名称。当它们中的任何一个包含瑞典字符(å,ä或ö),也可能是其他人,我得到一个soapfault(看起来我们没有XML文档)。我可以看到使用$ soapcalo - > __ getLastResponse()的完整(正确的afaik)响应。



如何处理特殊字符?我尝试在客户端和服务器上添加编码属性(utf-8),但没有成功。



编辑:soap回复的摘录:

 <?xml version =1.0encoding =UTF-8?& 
< SOAP-ENV:Envelope xmlns:SOAP-ENV =http://schemas.xmlsoap.org/soap/envelope/xmlns:ns1 =...>
< SOAP-ENV:Body>
< ns1:callFunctionResponse>
< ns1:Response>
< ns1:result> success< / ns1:result>
< ns1:content>
< Contact>
< userName> VIB09SLA9EP< / userName>
< firstName> Patrik< / firstName>
< lastName> Stenstr& ouml; m< / lastName>
< / Contact>
< / ns1:content>
< / ns1:Response>
< / ns1:callFunctionResponse>
< / SOAP-ENV:Body>
< / SOAP-ENV:Envelope>


$ b

谢谢!

解决方案

Ok大家 - 问题终于解决了,想我会发布在这里为其他人与similair问题。事实证明,这个问题发生在过程的早期。



SOAP回复的内容是建立一个带有DomDocument的结构。后来用saveHTML函数保存。事实证明,该函数添加了一些HTML编码,破坏了客户端上的soap解码。



当使用saveXML函数时,回复成功通过标签和其他奇怪的东西),并且也被soap客户端解码为正确的字符串。



我希望这是它的结束,但你永远不知道:)



感谢您的帮助和+1,帮助您检查正确的地点。



/ Victor


I have a problem related to this question. I have a web service (also using php) that returns some names. When any of them contains Swedish characters (å, ä or ö) and probably others as well i get a soapfault (looks like we got no XML document). I can however see the full (correct afaik) response using $soapcalo->__getLastResponse().

How do I handle the special characters? I have tried adding the encoding attribute (utf-8) on both client and server but without success.

Edit: Excerpt of the soap reply:

<?xml version="1.0" encoding="UTF-8"?>
 <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="...">
 <SOAP-ENV:Body>
  <ns1:callFunctionResponse>
   <ns1:Response>
    <ns1:result>success</ns1:result>
    <ns1:content>
     <Contact>
      <userName>VIB09SLA9EP</userName>
      <firstName>Patrik</firstName>
      <lastName>Stenstr&ouml;m</lastName>
     </Contact>
    </ns1:content>
   </ns1:Response>
  </ns1:callFunctionResponse>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Thanks!

解决方案

Ok everyone - problem finally solved, thought I'd post it here for anyone else with similair problems. As it turns out, the problem occured earlier in the process.

The content of the SOAP reply was generated building the structure with a DomDocument. Later that was saved with the saveHTML function. As it turns out, that function adds some HTML encodings which breaks the soap decoding on the client.

When instead using the saveXML function the reply gets through successfully (also when adding tags and other strange stuff) and is also decoded to the correct strings by the soap client.

I hope this is the end of it, but you never know :)

Thanks for all the help and +1 on those helpful to checking the right places.

/Victor

这篇关于php soap客户端中的特殊字符的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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