clue / reactphp-soap

Simple, async SOAP webservice client, built on top of ReactPHP.
https://clue.engineering/2020/announcing-reactphp-soap-2
MIT License
64 stars 25 forks source link

Replace Factory with simplified Client constructor #31

Closed clue closed 6 years ago

clue commented 6 years ago

This PR replaces the Factory with the now simplified Client constructor:

// old
$factory = new Factory($loop);
$factory->createClient($wsdl)->then(function (Client $client) {
    // client ready
    …
});

// new
$browser = new Browser($loop);
$browser->get($wsdl)->then(function (ResponseInterface $response) use ($browser) {
    $client = new Client($browser, (string)$response->getBody());
    // client ready
    …
});
// old
$factory = new Factory($loop);
$client = $factory->createClientFromWsdl($wsdl);

// new
$browser = new Browser($loop);
$client = new Client($browser, $wsdl);

Among others, this is also a prerequisite for non-WSDL mode (#5) and additional SOAP options. Builds on top of #26 and #30. Supersedes / closes #15.