isekaijin
isekaijin

Reputation: 19762

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?

Upvotes: 0

Views: 1717

Answers (1)

vicTROLLA
vicTROLLA

Reputation: 1529

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.

Upvotes: 3

Related Questions