8

I have created a function that calls a web service for contents of pdf file. The webservice works good.

I guess the problem comes when the file is too large.

I could fix this same problem on another server who had the same error throw the memory_limit and his php version is 5.4. The Nusoap version is the 0.9.5 and I'm using it via bundle from the composer.

This bundle is from https://packagist.org/packages/econea/nusoap and I'm using the v0.9.6.

In the server that I can't fix the error I use php 7.0. The Nusoap version is the 0.9.5 aswell in this server.

/**
 * @param string $docId
 * @return string
 */
public function getDocumentFromDocId(string $docId)
{
    $client = new \nusoap_client('http://'.$this->ip.'/arcdoc/WebServiceServer.php?wsdl', true);
    $response = $client->call('GetDoc', array(
        'xxxx1' => 'xxxxxx',
        'xxxx2' => base64_encode('xxxxx'),
        'xxxx3' => base64_encode("yyyyyyy"),
        'xxxx4' => base64_encode($docId)
    ));
    var_dump($response);
    return $response;
}

When I var_dump() the content response this response:

/var/www/html/project/src/AppBundle/Service/whatever.php:55:boolean false

If the file is bigger than 6-8M will be false the $response but if the file is less than 6-8M is not a problem.

So, I can say that the webservice works good in files with less size than 6-8M.

Any idea about why I'm not getting the answer?

I were testing to reduce the same pdf from 9M to 6M and works good, so it must be something about the size of the file. In my case seems to start to work bad at 7-9M.

  • That sounds as if the SOAP service provider has some limitations of the filesize active - have you checked back with the provider? – Lars Stegelitz Sep 25 '18 at 17:59
  • I will check that but if it was this point I wouldn't receive all the pdf content until EOF when I use the print_r function, isn't it? It's so weird. – Ricard Espinàs Llovet Sep 26 '18 at 07:11
  • Take a look [here](https://sourceforge.net/p/nusoap/discussion/193578/thread/12965595/?limit=25#2a6d) and see if it helps you. – wordragon Sep 28 '18 at 07:13
  • I'm using a bundle from composer and I don't want to overwrite this bundle to be able to update without problems via composer in the future but thank you anyway. – Ricard Espinàs Llovet Sep 28 '18 at 07:27

2 Answers2

0

I am not sure but it could be related to allowed memory size in PHP. Just try to increase and test it. You can edit it either from php.ini or from .htaccess (not suggested).

php.ini example:

memory_limit = 256M

.htaccess example:

php_value memory_limit 256M

P.S. You can change 256 whatever memory you need.

Sanan Guliyev
  • 441
  • 3
  • 6
  • Seems that is not the problem. I got 1024M in the php.ini's from apache2 and cli. But anyway the pdf it's like 9M. I also tried to add even a bigger number and "-1" in the memory limit. Nothing happens. So looks like to not be the answer I need. – Ricard Espinàs Llovet Sep 19 '18 at 15:10
0
$paramWSDLS = array(
    'soap_version' => SOAP_1_1,
    'encoding' => 'ISO-8859-15',
    'cache_wsdl' => WSDL_CACHE_NONE,
    'exceptions' => false,
    'trace' => true,
    'style' => SOAP_DOCUMENT,
    'use' => SOAP_LITERAL
);
$wsclient = new SoapClient('http://'.$this->ip.'/arcdoc/WebServiceServer.php?wsdl', $paramWSDLS );
$parametros = array(
   'xxxx' => 'xxxxxx',
   'xxxx2' => base64_encode('xxxxx2'),
   'xxxx3' => utf8_decode('xxxxx3'),
   'xxxx4' => utf8_decode('xxxxx4'),
   'showMask' => false
);
$response = $wsclient->__soapCall('GetDoc', $parametros );

Don't know why but using this SoapClient solved this problem.