简体   繁体   中英

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. By default, SoapClient deserializes the Web Service's SOAP responses into stdClass objects. 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.

Additionally you can overwrite it's do request method by extending the SoapClient class.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM