Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the possibility to use local WSDL files #11

Merged
merged 1 commit into from
Mar 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}