Ömer Ergün's avatar

How do i get a transfer encoding chunked response from a Soap request?

I'm using Laravel SOAP Client (https://github.com/CodeDredd/laravel-soap) in a Laravel project.

The web service given below have several functions. https://servis.turkiye.gov.tr/services/g2g/kdgm/test/uetdsesya?wsdl

I can get data from most of them. Only one function is returning a pdf file as byte format. When i try to read the response, i only got a blank data. When i use The SoapUI, it returns me back the pdf file. But in PHP it's not working somehow.

For example, this code returns data without problem.

public function getSupplyCarryTypes(Request $request)
{
    $response = Soap::baseWsdl('https://servis.turkiye.gov.tr/services/g2g/kdgm/test/uetdsesya?wsdl')
        ->withBasicAuth('999999', '999999testtest')
        ->withOptions([
            'trace' => false,
            'encoding' => 'UTF-8',
            'cache_wsdl' => WSDL_CACHE_NONE,
        ])
        ->call('paramTehlikeliMaddeTasimaSekli',array(
            'wsuser' => array('kullaniciAdi' => '999999', 'sifre' => '999999testtest')));

    dd($response);
}

But when i try this one, it returns null. It normally returns a PDF file as bytes. At least it's working well in SoapUI. After cheking the raw codes in SoapUI, i saw that the only difference is "Transfer Encoding : chunked".

public function getVoyageReport() // Not Working
{
    $response = Soap::baseWsdl('https://servis.turkiye.gov.tr/services/g2g/kdgm/test/uetdsesya?wsdl')
        ->withBasicAuth('999999', '999999testtest')
        ->withOptions([
            'trace' => false,
            'encoding' => 'UTF-8',
            'cache_wsdl' => WSDL_CACHE_NONE,
        ])
        ->call('seferRaporuV3', array(
            'wsuser' => array('kullaniciAdi' => '999999', 'sifre' => '999999testtest'),
            'seferId' => '21042300246027'));

    dd($response);
}

Here is working SoapUI XML output. https://ibb.co/1M2xCcT

Here is working SoapUI Raw output. https://ibb.co/3c4bmbT

I would be really happy, if someone help me on this. Thanks.

0 likes
1 reply
Ömer Ergün's avatar
Ömer Ergün
OP
Best Answer
Level 1

I solved the problem by using standart Php Soap Client.

Please or to participate in this conversation.