phpweb-servicespdfnusoap

Weird behaviour receiving a pdf content from a webservice nusoap


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.


Solution

  • $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.