How to overcome maxreceivedmessagesize using php soapclient on linux - php

Hi I am interrogating a windows service on a remote IIS server from my Linux server using PHP soapclient.
Everything's working fine except when I make a request that returns a large chunk of data, I get the following message:
Fatal error: Uncaught SoapFault exception: [a:InternalServiceFault] The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.
Is there something I can do with SoapClient to increase this value? I assume that it is at my end that the problem is arising...? Everything I read says to 'increase the MaxReceivedMessageSize in the appropriate web.config or app.config'. I don't have anything like that here on the client-side, just a couple of lines of PHP that make the call using the PHP soap class.
Any help welcome!

Related

PHP - Interbase - Call to undefined function ibase_connect()

I'm trying to connect to a Firebase Database server but I'm getting:
PHP Fatal error: Uncaught Error: Call to undefined function ibase_connect()
It was working good, but today it started to throw that error. I've been for the last hours searching on the internet in every page, even in Portuguese, but nothing helps.
Almost in every post they are dealing with W/L/XAMPP, but that doesn't help.
I'm trying this on a valueserver shared host (I don't even know which company is that). PHP Version: 7.2.1
The file is running via cron job.
This is what I'd tried:
Verify in php.ini that interbase is uncommented.
Look for server errors (none).
Please I don't know what to do.

NuSOAP - HTTP Error: no data present after HTTP headers

I'm getting an error from a PHP API -
HTTP Error: no data present after HTTP headers
The API uses NuSOAP 0.9.5 .
Before the HTTP Error, I had the error
Fatal error: Maximum execution time of 30 seconds exceeded
so I set the max_execution_time to 300s.
There's no problem if I limit the number of rows in the SQL query (rownum < 2100), but if I remove the limit I get the HTTP Error.
Could this be a memory problem or a limitation of NuSOAP?
Specs:
WAMP (Apache 2.2.21, PHP 5.3.10)
Oracle 12c
Note: I searched for this question and I got two results, but none of them them specified using NuSOAP. One was unanswered, the other had an answer stating that the HTTP response body contained no data which doesn't answer my problem.
It was a memory issue.
I increased the value of memory_limit in php.ini and it works fine.

SOAP Fault - "Error build soap request" on large request size

This error occurs SoapFault - Error build soap request on the requests done by a PHP programme which are larger than 100MB
The stack trace points the error to the line below which is from the client library provided with the service by the vendor:
$this->__soapCall('ProcessBatch', array($parameters));
I have changed the service config file as advised by the vendor but they say that this error is happening in PHP side rather than the service.
I have all my PHP ini settings changed to accommodate larger POST requests, processing times, file uploads and all that. I can't find a setting about SOAP request message length anywhere.
Any help would be highly appreciated!!

SoapClient in PHP 5.6 when using HTTPS emits warning with "key values mismatch"

After upgrading to Debian 8 with PHP 5.6.9 (change from PHP 5.4) I'm getting this warning when calling SOAP web service with HTTPS endpoint address:
Warning: SoapClient::__doRequest(): SSL operation failed with code 1. OpenSSL Error messages:
error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch
followed by SoapFault:
Fatal error: Uncaught SoapFault exception: [HTTP] Error Fetching http headers
Calling file_get_contents with the web service URL doesn't trigger this warning.
I don't have any stream context options set for ssl on this SOAP call.
Do you have any clue what does this warning mean in this context and how to properly get rid of it?
EDIT
In my specific use case I'm calling two web service methods: A and B. Method A is working without warning, then some openssl methods are called on its result, and then method B is called which trigger the warning. When I remove the call to method A and load its result from cache, method B (and any other) works without warnings. It's bizarre - I need to investigate further.
EDIT2
I've extracted the problem and made it testable. It seems that following scenario causes this warning:
Call some SOAP method with HTTPS endpoint.
Call openssl_pkcs12_read on PKCS#12 file with extra certificates.
Call some SOAP method with HTTPS endpoint again. It will cause warning and SoapFault.
Below is example using some publicly available SOAP webservice and self-signed certificate.
<?php
$p12 = 'MIIMgQIBAzCCDEcGCSqGSIb3DQEHAaCCDDgEggw0MIIMMDCCBucGCSqGSIb3DQEHBqCCBtgwggbUAgEAMIIGzQYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQYwDgQIHkgJ646mKooCAggAgIIGoFEhy5EmHjteHd4+Q8mUrtY74fszKgwvnhO20g5zneMP39UbQBW3MPSMmMNXuCSG0NqJeiMG/z4WESUMKchhiAe+l4+trbGnFHaNLes6qrItUvMaD2vOtIv4n2ywY99GS4G/dVpM1TWBoXFAQXqJkTXD1SxqX7J0iau+g5u9PV1yaiUAnhbRzsE3SuFdVJo0d3C66XbROKbn45Q+cPDOHCSmOTrQmANvU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Vx632DbWhJpMIK2PGD8+V5rXkczf6zd2uGDY85g4aoK2ozmkf0/IUFL+ChpByXD0FqZ8szg/xOut0yR3wFFugLHMfBeR4QKb3ZFGX1g4i8HIejWqoRohnV2MpPGgfKB3AXBdkhQr7cFurtFe6PSI2UEDmdO6YLYuP3rkLJpyH6lBCqAcL7jFkKlzMnlrXEqnZ/eAsJpyAbm8QxbJLZiXFQqbCuO22u0Q6r2bDPqDxACP5S2utJnD5yFaFuEIESYn1KlAXJoPFiRO4K4iRpspIZM1KY7/xFsj4ssGjOY/6O+K0Sxmg+qLwpxCpBvk1leusNb9Ua6bEMGiWUTS+PptkMmou/cYycoIlsIFx/lzmxSi1IsI+x/SSlOj0V2+FnLW0to5DgmJj0Y6Cg9hyI5UGhLTdNjtgFv2VEZ5F862c6aehpsEUcN5lRAb75fxZWiAHptGPH+M6xLsH0e6jRCGGfaoz1nA/vGDTJbhvQh+gTuerjuhnxMLkXt58bpQNiC5KB3lY78dch+/TzElMCMGCSqGSIb3DQEJFTEWBBThvL9jHiqk9kxxa+fO4m1Klc0mWzAxMCEwCQYFKw4DAhoFAAQU2t4LC2xjLRH7pTlVgA3R6iJ7TYsECA+RO2Li8MyxAgIIAA==';
$sc = new SoapClient('https://finanzonline.bmf.gv.at/fon/services/FileUploadWSI/wsdl/FileUploadWSIService.wsdl');
var_dump($sc->GetVersion());
$result = openssl_pkcs12_read(base64_decode($p12), $cert_data, 'qwerty');
var_dump($cert_data);
var_dump($sc->GetVersion());
Could somebody test this script? In PHP Version 5.6.9-0+deb8u1 with OpenSSL 1.0.1k 8 Jan 2015 I've got no second result of GetVersion call and the warning and error.
EDIT3
Same result in PHP 7 Alpha 1. Reported as Bug #69882.
I've confirmed that this is PHP bug, and was introduced in PHP 5.6.7, in commit fd4641696cc67fedf494717b5e4d452019f04d6f.
The workaround is to call openssl_error_string() after
openssl_pkcs12_read().
Update
A pull request has been submitted to address this issue - merged

Apache-PHP max_execution_time fatal exception handling

I have a PHP module that fetches data from an Oracle DB, using the call
oci_Execute(statement);
Now based on the search parameters provided by the user the search can sometimes takes more than 30 minutes. In such cases I want to cancel the search (at PHP level) and notify the user to reconsider the search params.
I attempted that by setting the PHP timeout variable max_execution_time in php.ini file. I have set up a ErrorDocument 404 redirect in the apache httpd.conf file (and it works fine with not found php pages). However, when the php times out and the oci_execute is still processing, PHP throws a fatal exception and crashes.
I have already tried try/catch and came to know that it doesn't work for fatal errors.
I have tried registering a shutdown function via register_shutdown_function, it is never reached after the fatal error.
I have tried setting apache timeout directives but they never take effect in the presence of PHP scripts.
I want either apache or PHP to respond with an error code and redirect to a page saying 'dear user please reconsider your search parameters' :) at the moment I see a fatal exception after timeout generated at oci_Execute line.
Rephrasing the question; how can I get out of the oci_execute call without a fatal exception, anything but a fatal exception will work.
At the Oracle database level, you can set a resource limit by altering the Profile. You should be able to trap the "error" from Oracle when you hit the resource limit.
ALTER PROFILE:
http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_2008.htm#SQLRF00813

Categories