Skip to content

Commit

Permalink
Add engine-based HTTP example as well
Browse files Browse the repository at this point in the history
  • Loading branch information
veewee committed Jun 7, 2024
1 parent 2af958a commit 896f8e0
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
4 changes: 0 additions & 4 deletions examples/calc.php → examples/calc-encode.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,3 @@
$decoded = $driver->decode('Add', $response);

var_dump($decoded);




30 changes: 30 additions & 0 deletions examples/calc-http.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use GuzzleHttp\Client;
use Soap\Encoding\Driver;
use Soap\Engine\SimpleEngine;
use Soap\Psr18Transport\Psr18Transport;
use Soap\Wsdl\Loader\StreamWrapperLoader;
use Soap\WsdlReader\Wsdl1Reader;

$wsdlLocation = 'https://ecs.syr.edu/faculty/fawcett/Handouts/cse775/code/calcWebService/Calc.asmx?wsdl';

$engine = new SimpleEngine(
Driver::createFromWsdl1((new Wsdl1Reader(new StreamWrapperLoader()))($wsdlLocation)),
Psr18Transport::createForClient(
new Client([
'headers' => [
'User-Agent' => 'testing/1.0',
],
])
)
);

var_dump($engine->request('Add', [
(object)[
'a' => 1,
'b' => 2
]
]));

0 comments on commit 896f8e0

Please sign in to comment.