The title says it all. This post is about how PHP5 SoapClient behaves when there is an attachment in the SOAP response.
You request some data from an API, the result set is too large to be sent over SOAP, so the server sends you a simple valid XML response containing “Return result is too large, Please get your result from attachement”,and the resultset as a CSV document attached to the response. This makes sense.
The only problem is the default SoapClient in PHP can’t handle this kind of situations. The only thing you get is a SoapException with the following message : looks like we got no XML document.
Because PHP tries to parse the entire response. and we must face it :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
is not a valid XML response at all.
This is it, if you are facing a problem like this think of this before you panic. Try another Soap library for PHP, there are plenty of them.