[英]Using PHP's SoapClient, how to deserialize SOAP responses into a custom class?
I have a PHP Web application that consumes a Web Service using PHP's native SoapClient
class. 我有一个PHP Web应用程序,它使用PHP的本机
SoapClient
类使用Web服务。 By default, SoapClient
deserializes the Web Service's SOAP responses into stdClass
objects. 默认情况下,
SoapClient
将Web服务的SOAP响应反序列化为stdClass
对象。 I would like to override this default. 我想覆盖此默认设置。 How can I do that?
我怎样才能做到这一点?
You can use SoapClient's __getLastResponse() method to get the raw XML response back as a string instead of an object. 您可以使用SoapClient的__getLastResponse()方法以字符串而不是对象的形式获取原始XML响应。
Additionally you can overwrite it's do request method by extending the SoapClient class. 另外,您可以通过扩展SoapClient类来覆盖它的请求方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.