I\'m trying to run a web service using PHP & SOAP, but all I\'m getting so far is this:
(SoapFault)[2] message which states: \'SOAP-ERROR: Parsing
I am using selinux and with the following shell command (as root) I was able to allow PHP to make SOAP calls:
sudo setsebool -P httpd_can_network_connect on
If you use docker there is a chance you get error because of OpenSSL default security level.
You need lower seclevel in /etc/ssl/openssl.cnf
from DEFAULT@SECLEVEL=2
to DEFAULT@SECLEVEL=1
Or just add into Dockerfile
RUN sed -i "s|DEFAULT@SECLEVEL=2|DEFAULT@SECLEVEL=1|g" /etc/ssl/openssl.cnf
Source: https://github.com/dotnet/runtime/issues/30667#issuecomment-566482876
After that change I can run SoapClient without any additional options
You can verify it by run on container
curl -A 'cURL User Agent' -4 https://ewus.nfz.gov.pl/ws-broker-server-ewus/services/Auth?wsdl
Put this code above any Soap call:
libxml_disable_entity_loader(false);
Just had a similar problem trying to use SoapClient. Everything was working fine but in production, sometimes on page refresh, I would get the "SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from .." error.
I was using the params:
new \SoapClient($WSDL, array('cache_wsdl' => WSDL_CACHE_NONE, 'trace' => true, "exception" => 0));
Removing all the params worked for me:
new \SoapClient($WSDL);
try this. works for me
$options = array(
'cache_wsdl' => 0,
'trace' => 1,
'stream_context' => stream_context_create(array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
))
$client = new SoapClient(url, $options);
I had the same problem.
This php setting solved my problem:
allow_url_fopen -> 1