Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ignore or inspect "SOAP-ERROR: Encoding: Violation of encoding rules" in PHP

Tags:

php

soap

Hi i make a soap call in my php application

$options = array(
    'soap_version' => SOAP_1_1,
    'exceptions' => true,
    'trace' => 1,
    'cache_wsdl' => WSDL_CACHE_NONE,
    'local_cert' => 'my.key',
);
$client = new SoapClient('http://domain.com/my.wsdl', $options);
var_dump($client->functionName($args));

which results in an exception

SOAP-ERROR: Encoding: Violation of encoding rules

i guess the problem is the server-respnse, because

$client->__getLastResponse()

contains a good-looking server response, according to other questions there is probably a value type mismatch.

Is it possible to find out which value is causing this error or is it possible to disable this check?

like image 613
wutzebaer Avatar asked Oct 31 '22 16:10

wutzebaer


1 Answers

You probably are right and the problem is in the server-response, I had similar problem, the returned XML was well formatted and looked good, but it didn't pass the schema validation.

I don't know how to debug it in PHP and I also would like to know how to ignore this validation (and error throwing) but this answer helped me to find the problem in response: https://stackoverflow.com/a/12171635/3999906

like image 174
kbalcerek Avatar answered Nov 14 '22 12:11

kbalcerek