I have a php array that I send to a SOAP service, but the service returns an error
$params = ["key1"=>"value 1", "key2" => "value 2"];
$soap = new SoapClient($url, ["trace"=>true]);
$data = $soap->metodo($params);
This operation returns me:
Server was unable to read request. ---> There is an error in XML document (2, 461). ---> The string '' is not a valid AllXsd value.
Understanding that the message indicates that there is an error in the XML format, what I want is to manually validate the resulting XML that is sent to the SOAP service.
How can I generate an output of the resulting XML that is sent to the service? If possible, I would like to obtain it before sending it to the SOAP service to be able to validate it. I have tried to make a "trace" in "SoapClient" but apparently, because the process aborts its execution... I cannot obtain any other data from the process that will help me to obtain the resulting XML that is sent to the service.
Thanks in advance!
Take a look at the SoapClient documentation.
https://www.php.net/manual/en/soapclient.getlastrequest.php