Skip to content

Commit

Permalink
Added the possibility to use local WSDL files
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Simon committed Sep 4, 2015
1 parent 0da2761 commit ebedc0f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ $factory->createClient($url)->then(
);
```

#### createClientFromWsdl($wsdlContents)

Same as createClient(), but leaves you the responsibility to load the WSDL file. This allows you to use local WSDL files, for instance.

### Client

The `Client` class is responsible for communication with the remote SOAP
Expand All @@ -105,6 +109,8 @@ All public methods of the `Client` are considered *advanced usage*.
The `soapCall($method, $arguments)` method can be used to queue the given
function to be sent via SOAP and wait for a response from the remote web service.

Note: This is considered *advanced usage*, you may want to look into using the [`Proxy`](#proxy) instead.

#### getFunctions()

The `getFunctions()` method returns an array of functions defined in the WSDL.
Expand Down Expand Up @@ -157,8 +163,8 @@ $proxy->demo()->then(

## Install

The recommended way to install this library is [through composer](packagist://getcomposer.org).
[New to composer?](packagist://getcomposer.org/doc/00-intro.md)
The recommended way to install this library is [through composer](http://getcomposer.org).
[New to composer?](http://getcomposer.org/doc/00-intro.md)

```JSON
{
Expand Down
16 changes: 11 additions & 5 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@ public function __construct(LoopInterface $loop, Browser $browser = null)

public function createClient($wsdl)
{
$browser = $this->browser;

return $this->browser->get($wsdl)->then(function (Response $response) use ($browser) {
$url = 'data://text/plain;base64,' . base64_encode((string)$response->getBody());
$that = $this;

return new Client($url, $browser);
return $this->browser->get($wsdl)->then(function (Response $response) use ($that) {
return $that->createClientFromWsdl($response->getBody());
});
}

public function createClientFromWsdl($wsdlContents)
{
$browser = $this->browser;
$url = 'data://text/plain;base64,' . base64_encode((string)$wsdlContents);

return new Client($url, $browser);
}
}

0 comments on commit ebedc0f

Please sign in to comment.