soapclient using https randomly closes connection

View: New views
4 Messages — Rating Filter:   Alert me  

soapclient using https randomly closes connection

by Galmok :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am using php 5.2.9 (solaris) and have access to a .NET webservice that I
have to access using https.

In most cases, accessing it works just fine, but every now and again,
SoapClient closes the connection before actually having transfered the
request, erroring with "could not connect to host ...".

I have captured the actual communication using snoop and examined the
result
in wireshark and I see that the tcp connection to the webservice is
established correct, but before the request is transmitted, SoapClient
closes the tcp-connection which is acknowledged by the webservice which
also
resets the TCP connection.

When I disable the caching of the WSDL file for SoapClient, I get these
errors (not always, only sometimes):

Warning: SoapClient::SoapClient() [soapclient.soapclient]: failed to create
an SSL context in /space/hom

Warning: SoapClient::SoapClient() [soapclient.soapclient]: Failed to enable
crypto in /space/home

Warning: SoapClient::SoapClient(https://sitename.../pathto?WSDL)
[soapclient.soapclient]: failed to open stream: operation failed in
/space/home

Warning: SoapClient::SoapClient() [soapclient.soapclient]: I/O warning :
failed to load external entity "https://sitename.../pathto?WSDL" in
/space/hom

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL:
Couldn't load from 'https://...


If I would get this error every time, I'd be more happy, but when it only
occurs once in a while (like every 10. connect), I am more at a loss.
But it
does seem like SoapClient is at fault.

Any suggestions?

/Bernhard

--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: soapclient using https randomly closes connection

by Galmok :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bernhard Ege wrote:
> I am using php 5.2.9 (solaris) and have access to a .NET webservice that I
> have to access using https.
>
> In most cases, accessing it works just fine, but every now and again,
> SoapClient closes the connection before actually having transfered the
> request, erroring with "could not connect to host ...".

I am currently working around it by having SoapClient use only http
access, but having it connect via stunnel that converts the http access
to https. This seems solid enough so far.

So basically you have to avoid https in soapclient with php 5.2.9.

Bernhard

--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: soapclient using https randomly closes connection

by Sriram Natarajan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Bernhard Ege wrote:

> I am using php 5.2.9 (solaris) and have access to a .NET webservice
> that I
> have to access using https.
>
> In most cases, accessing it works just fine, but every now and again,
> SoapClient closes the connection before actually having transfered the
> request, erroring with "could not connect to host ...".
>
> I have captured the actual communication using snoop and examined the
> result
> in wireshark and I see that the tcp connection to the webservice is
> established correct, but before the request is transmitted, SoapClient
> closes the tcp-connection which is acknowledged by the webservice
> which also
> resets the TCP connection.
>
> When I disable the caching of the WSDL file for SoapClient, I get these
> errors (not always, only sometimes):
>
> Warning: SoapClient::SoapClient() [soapclient.soapclient]: failed to
> create
> an SSL context in /space/hom
>
> Warning: SoapClient::SoapClient() [soapclient.soapclient]: Failed to
> enable
> crypto in /space/home
>
This warning suggests that PHP is unable to create a SSL stream context
. By default, if you disable caching, PHP has to download the wsdl to
your /tmp directory. Is is possible you are running out of disk space in
/tmp.

- Sriram

> Warning: SoapClient::SoapClient(https://sitename.../pathto?WSDL)
> [soapclient.soapclient]: failed to open stream: operation failed in
> /space/home
>
> Warning: SoapClient::SoapClient() [soapclient.soapclient]: I/O warning :
> failed to load external entity "https://sitename.../pathto?WSDL" in
> /space/hom
>
> Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing
> WSDL:
> Couldn't load from 'https://...
>
>
> If I would get this error every time, I'd be more happy, but when it only
> occurs once in a while (like every 10. connect), I am more at a loss.
> But it
> does seem like SoapClient is at fault.
>
> Any suggestions?
>
> /Bernhard
>

--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: soapclient using https randomly closes connection

by Galmok :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sriram Natarajan wrote:

>
>
> Bernhard Ege wrote:
>> I am using php 5.2.9 (solaris) and have access to a .NET webservice
>> that I
>> have to access using https.
>>
>> In most cases, accessing it works just fine, but every now and again,
>> SoapClient closes the connection before actually having transfered the
>> request, erroring with "could not connect to host ...".
>>
>> I have captured the actual communication using snoop and examined the
>> result
>> in wireshark and I see that the tcp connection to the webservice is
>> established correct, but before the request is transmitted, SoapClient
>> closes the tcp-connection which is acknowledged by the webservice
>> which also
>> resets the TCP connection.
>>
>> When I disable the caching of the WSDL file for SoapClient, I get these
>> errors (not always, only sometimes):
>>
>> Warning: SoapClient::SoapClient() [soapclient.soapclient]: failed to
>> create
>> an SSL context in /space/hom
>>
>> Warning: SoapClient::SoapClient() [soapclient.soapclient]: Failed to
>> enable
>> crypto in /space/home
>>
> This warning suggests that PHP is unable to create a SSL stream context
> . By default, if you disable caching, PHP has to download the wsdl to
> your /tmp directory. Is is possible you are running out of disk space in
> /tmp.
> - Sriram

Thank you for the response, but there is plenty of space to save the
WSDL file. Also, if I cache the wsdl file, the actual service calls fail
to send a request (the tcp connection is created). As the same soap
service can be accessed via http instead of https, AND http never fails,
the problem seems to be creating a SSL context for some reason. When
retrying, it works after about 10-15 seconds but fails immediately when
retrying before that.

Because https is unrealiable, I have created a http<->https tunnel using
stunnel and I have made SoapClient access using http via stunnel (that
converts to/from https stream) to the webservice. Doing this is so far
100% reliable (even without caching the wsdl file).

To me this clearly indicates that SoapClient has occasional problems
with SSL (in php 5.2.9 on Solaris).

I'll create en rc-file to ensure stunnel is started when the OS boots
and with that I have worked around the bug in SoapClient.

/Bernhard

--
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php