Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PHP SoapClient?

269 views
Skip to first unread message

Kevin Burton

unread,
Mar 29, 2014, 10:40:53 PM3/29/14
to
I pass the following options to the SoapClient (attempting to establish an SSL connection):

$ssl_opts = array('local_cert' => $certinfo,
'verify_peer' => true);

Then merge them in with the other SoapClient parameters like 'typemap' and 'classmap'. This gives me the error that the WSDL cannot be loaded from the path. If I take this same path and feed it to a Chrome browser I get a WSDL, so the file is getting served. Also when I supply a non SSL URL (http://. . . . . rather than https://. . . . .) to the SoapClient constructor without the SSL options everything works fine. Any ideas what will work to connect to an SSL site?

I am using PHP 5.5.10 with SOAP and OpenSSL extensions enabled.

Thank you for any help you may be able to offer.

J.O. Aho

unread,
Mar 30, 2014, 3:41:57 AM3/30/14
to
On 30/03/14 04:40, Kevin Burton wrote:
> I pass the following options to the SoapClient (attempting to establish an SSL connection):
>
> $ssl_opts = array('local_cert' => $certinfo,
> 'verify_peer' => true);
>
> Then merge them in with the other SoapClient parameters like 'typemap' and 'classmap'.
> This gives me the error that the WSDL cannot be loaded from the path.
> If I take this same path and feed it to a Chrome browser I get a
WSDL, so the file is getting served.
> Also when I supply a non SSL URL (http://. . . . . rather than https://. . . . .) to the SoapClient
> constructor without the SSL options everything works fine. Any ideas what will work to connect to an SSL site?

This looks like issues to verify the certificate. It's easier if you
would check the error message to really see what is wrong, at least add
something like in the examples in:

http://www.php.net/manual/en/function.is-soap-fault.php

but things to start with:

Is the certificate self signed?

Then you need to set the allow_self_signed

also, do you cafile set?

You may need to download one. http://curl.haxx.se/ca/cacert.pem could
work (seen some people use it, but can't say if it's up to date).


--

//Aho

Kevin Burton

unread,
Mar 30, 2014, 9:35:55 AM3/30/14
to
Thank you for your help. I added the allow_self_signed => true because it is a self-signed certificate. But I get the same exception:

Exception - SOAP-ERROR: Parsing WSDL: Couldn't load from '(url)?WSDL' : failed to load external entity "(url)?WSDL"

I am catching the exception thrown which as I read the documentation is essentially the same as is_soap_fault.

If I don't pass any SSL arguments I get a SOAP Fault that I have passed invalid SOAP arguments. I am just trying to connect to an SSL endpoint. This seems to work when I use curl but these options don't seem to work using SoapClient.

Thanks again.

white.j...@gmail.com

unread,
May 28, 2014, 11:48:16 AM5/28/14
to
I ran into a similar problem and here is how I fixed it.
$soapclient_options['local_cert'] = PEM_LOCATION;
$soapclient_options['passphrase'] = PEM_PASS;

I never included the PEM passphrase in my initial calls. once I did that it worked like a charm.
0 new messages