DKP Posted November 18, 2009 Share Posted November 18, 2009 I'm trying to use PHP to communicate w/ a web service via SOAP / HTTP. I was actually able to get this to work fairly quickly using the SoapClient class as show below. However, the service is storing some additional information in the "details" section of the SOAP fault, but I don't see from the docs how to get access to that data? The SoapFault constructor appears to take "details" as an argument, but is it possible to retrieve this information in PHP? try { $client = new SoapClient("my.wsdl"); $result = $client->func($params);}catch (SoapFault $fault) { $code = $fault->faultcode; $message = $fault->getMessage();} Also is there a way to get access to the underlying XML from the SOAP message? This might be handy for debugging. Link to comment Share on other sites More sharing options...
justsomeguy Posted November 18, 2009 Share Posted November 18, 2009 The details of the error are in the various properties of the SoapFault object:http://www.php.net/manual/en/class.soapfault.php Link to comment Share on other sites More sharing options...
DKP Posted November 18, 2009 Author Share Posted November 18, 2009 Yes, I read this page, but it says nothing about the "details" section of the soap fault. I've dumped the contents of every documented public method and I still cannot find the data. The constructor has a "$details" argument, which I'm assuming is what I'm looking for. What public variable does that data get stored in, or what method can I use to access it? Link to comment Share on other sites More sharing options...
justsomeguy Posted November 18, 2009 Share Posted November 18, 2009 This is how it shows the constructor for the SoapFault class:__construct ( string $faultcode , string $faultstring [, string $faultactor [, string $detail [, string $faultname [, string $headerfault ]]]] )It shows 4 properties listed on that page, plus a couple methods like toString that may have what you want. I would probably check the message property first. If you use var_dump with the object it will list what's in each property, there may be undocumented properties. Link to comment Share on other sites More sharing options...
DKP Posted November 18, 2009 Author Share Posted November 18, 2009 The var_dump() did the trick. There is a non-documented property called "detail" that contains the information I'm looking for. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.