I want to consume SOAP webservices in php. I got success when wsdl path is over http protocol but when I changed to https this started to throw following exception.
SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://localhost:8443/../someWsdl.wsdl' : failed to load external entity "https://localhost:8443/.../someWsdl.wsdl"
This exception is thrown at a time of SOAPClient object creation. I compared both the wsdl files obtained by http and https, both have same content except webservice location path in one place. So why parsing exception is thrown?
I have tried some of the suggestions from Internet but that don't work for me:
- Enable soap, openssl in php.
- Passing local_cert as option with local certificate path in the constructor of SoapClient call.
- Passing wsdl location as https://oc_username:oc_password@localhost:8443/OpenClinica-ws/ws/study/v1/studyWsdl.wsdl for login into openclinica and then access webservice.
My requirement is to access webservices over https protocol. Is there any other options which need to pass in SoapClient constructor for creating SoapClient object, when web-service URL path is over https protocol? Can you please help me to resolve above issue and suggest any reference document available for it.
Updated: This is my code:
$wsdl = "https://localhost:8443/.../someWsdl.wsdl"; $client = new SoapClient($wsdl, array( 'trace' => 1 ));
I had a similar issue that was caused by the XML in the WSDL file specifying port 81 while attempting to use HTTPS (should be 443).
I fixed this by specifying the
location
option of the PHP SoapClient to that of my WSDL file. This explicitly forced the location to the HTTPS address. Snippet: