Stuart
Stuart

Reputation:

Error message trying to catch a soapfault using the PHP Soap class

For some reason I can't catch the error. I'm following an example in O'Reillys PHP cookbook, so I'm not doing any cowboy coding (yet).

The error is:

SoapFault exception: [SOAP-ENV:Server] SoapFault::SoapFault() [soapfault.soapfault]: Invalid parameters. Invalid fault code. in C:\xampp\htdocs\soap\client_database.php:13 Stack trace: #0 C:\xampp\htdocs\soap\client_database.php(13): SoapClient->__soapCall('select_query', Array) #1 {main}

Upvotes: 1

Views: 6680

Answers (3)

Ionuț G. Stan
Ionuț G. Stan

Reputation: 179119

As per the standards there are only 5 possible options for a fault code:

  1. VersionMismatch
  2. MustUnderstand
  3. DataEncodingUnknown
  4. Sender
  5. Receiver

Choose the most appropriate to your situation and use that one as a value for $faultCode when throwing a SoapFault exception.

Upvotes: 1

Stuart
Stuart

Reputation:

I found the solution, you can only use certain error codes when throwing an error.

http://www.w3.org/TR/soap12-part1/#faultcodes

Upvotes: 1

Bob Fanger
Bob Fanger

Reputation: 29897

I got other (weird) SOAP errors in php 5.2.0 which where resolved in php 5.2.8

If you're not on the latest version of php I suggest upgrading and see what happens

Upvotes: 0

Related Questions