S
S
stainer2022-01-25 10:10:00
PHP
stainer, 2022-01-25 10:10:00

Why doesn't soap yii2 work?

Good afternoon!
I'm trying to raise a soap server on yii2, I installed subdee/yii2-soap-server.
This is how I try to test:

public function  actionTest() {
        ini_set('soap.wsdl_cache', 0);
        ini_set('soap.wsdl_cache_enabled', 0);
        ini_set('soap.wsdl_cache_ttl',0);
        $context = stream_context_create([
            'ssl' => [
                // set some SSL/TLS specific options
                'verify_peer' => false,
                'verify_peer_name' => false,
                'allow_self_signed' => true
            ]
        ]);
        $client = new \SoapClient('../modules/soap/wsdl/service.wsdl', [
            'trace' => 1,
            'stream_context' => $context
        ]);
        try {
            header('Content-Type: application/xml');
            $res = $client->setDataChange('applyByCar');
            var_dump($client->__getLastRequest());
            echo '<br>---------<br>';
            var_dump($client->__getLastRequestHeaders());
            echo '<br>---------<br>';
            var_dump($client->__getLastResponse());
            echo '<br>---------<br>';
            var_dump($client->__getLastResponseHeaders());
            echo '<br>---------<br>';
            print_r($res);
        } catch (SoapFault $e) {
            header('Content-Type: text/plain');
            echo 'Soap Error' . PHP_EOL;
            echo strip_tags($client->__getLastResponse());
        }
    }

This is __getLastRequest():
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:xmethods-delayed-quotes"><SOAP-ENV:Body><ns1:setDataChange><dataName>applyByCar</dataName></ns1:setDataChange></SOAP-ENV:Body></SOAP-ENV:Envelope>

And the response is empty, although the method in the controller created:
61efa2409b1ab358102261.png

Many thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
stainer, 2022-01-25
@stainer

The problem was in the local SSL certificate.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question