tags:

views:

1819

answers:

3

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}
A: 

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

Bob Fanger
I'm on 5.2.4 I think. May upgrade later. The SOAP library is quite new I think, still a few teething problems.
+1  A: 

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

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

A: 

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.

Ionuț G. Stan