0

How can I integrate a soap client in TYPO3 Extbase? I have installed php_soap on the webserver. Can I use the normal http://php.net/manual/de/soapclient.soapclient.php implementation?

$client = new SoapClient("my.wsdl", array('login'          => "my_name",
                                       'password'       => "my_passwort"));

Maybe there are some extbase implementations available?

Thanks for a quick tipp. I dint' find good extbase documentation for this purpose.

Just found this: Create object in extbase extension from a PHP standard class

How to make a PHP SOAP call using the SoapClient class

StatiX
  • 854
  • 6
  • 21
bstaub
  • 53
  • 1
  • 6
  • 1
    There isn't a soap client extension per se, as there's a long list of use cases that can't be covered in one extension. What you should do, is to implement a soap client that supplies the features needed - such as https://packagist.org/packages/phpro/soap-client into your extbase extension. This is trivial if you handle your dependencies through composer. – Jacob Rasmussen Jan 20 '19 at 21:18

1 Answers1

0

I would create a SoapService class and inject it in an extbase controller.

The SoapService class can be easily injected in the Controller the service would look like this :

<?php

namespace Vendor\Name\Service;


class SoapService
{
    /**
     * @var \SoapClient
     */
    protected $client;

    /**
     * SoapService constructor.
     */
    public function __construct()
    {
        $this->client = new \SoapClient('my.wsdl', ['login' => 'my_name', 'password' => 'my_passwort']);
    }

    /**
     * Fetch data on webservice.
     *
     * @return mixed
     */
    public function fetchWhateverData() {
        $arguments = [];
        return $this->client->__soapCall("getWhateverOnSoapService", $arguments);
    }
}
StatiX
  • 854
  • 6
  • 21