Tuesday, May 3, 2011

Catching type mismatches with PHP Soap Server

I have a PHP5 Soap Server running and I'd like to catch type mismatches but I don't think they're even getting into my code.

What's happening is this, in my WSDL I've got (simplified):

<complexType name="Publishing">
 <all>
  <element name="EmailBlast" type="xsd:boolean"/>
  <element name="PublishRadius" type="xsd:int"/>
 </all>
</complexType>

which is fine, and comes through correctly as long as there's an Integer (or null) in the Publish Radius field. But if I try to send through a non-integer, I get nothing back in the response besides this:

<SOAP-ENV:Fault>
  <faultcode>SOAP-ENV:Server</faultcode>
  <faultstring>SOAP-ERROR: Encoding: Violation of encoding rules</faultstring>
</SOAP-ENV:Fault>

I'd like to catch this and return something more useful, but it doesn't even seem to be getting into my logic. Any suggestions?

From stackoverflow
  • I believe the error (SOAP Fault) you are seeing is being generated by the Soap Client and not being sent to the SOAP Server.

    epalla : Validated. Thank you very much! Can't believe I didn't think of that.

0 comments:

Post a Comment