Skip to content

Commit

Permalink
Merge pull request #11 from floriansimon1/allow-local-wsdl-files
Browse files Browse the repository at this point in the history
Added the possibility to use local WSDL files
  • Loading branch information
clue committed Mar 15, 2016
2 parents dcf86ae + 7a5c5a8 commit 5d9523b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
4 changes: 4 additions & 0 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 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 5d9523b

Please sign in to comment.