Jump to content

Soap Fault Details


DKP
 Share

Recommended Posts

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.

Edited by DKP
Link to comment
Share on other sites

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?

Edited by DKP
Link to comment
Share on other sites

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...