O
O
Ostap2017-01-12 09:54:02
PHP
Ostap, 2017-01-12 09:54:02

Is it possible to change the message SOAP-ERROR: Encoding: Violation of encoding rules?

Is it possible in SOAP to override the SOAP-ERROR: Encoding: Violation of encoding rules error message? I get this error when incorrect data is passed to a field with the long type. The task is that the service must respond to absolutely any non-valid request with errors defined by the customer. The problem is that I can't intercept this answer via try.

$server = new SoapServer('http://somehost/?wsdl', $soap_param);
$server->setClass('SomeClass');
try {
    $server->handle();
} catch (SoapFault $e) {
    throw new SoapFault($faultcode, $faultstring);
}

Processes the handle method, returns a response
SOAP-ERROR: Encoding: Violation of encoding rules

The script exits.
I tried to put the result of the handle in the buffer, so that later I can check it for the presence of this message, but in the case of this error, this does not help.
ob_start();
    $soapServer->handle();
    $soapXml = ob_get_contents();
    ob_end_clean();
...

Can you tell me how to override this message?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question