xref: /PHP-7.0/ext/soap/tests/transport001.phpt (revision 1d5c8006)
1--TEST--
2SOAP Transport 1: Local transport using SoapClient::__doRequest
3--SKIPIF--
4<?php require_once('skipif.inc'); ?>
5--FILE--
6<?php
7function Add($x,$y) {
8  return $x+$y;
9}
10
11class LocalSoapClient extends SoapClient {
12
13  function __construct($wsdl, $options) {
14    parent::__construct($wsdl, $options);
15    $this->server = new SoapServer($wsdl, $options);
16    $this->server->addFunction('Add');
17  }
18
19  function __doRequest($request, $location, $action, $version, $one_way = 0) {
20    ob_start();
21    $this->server->handle($request);
22    $response = ob_get_contents();
23    ob_end_clean();
24    return $response;
25  }
26
27}
28
29$x = new LocalSoapClient(NULL,array('location'=>'test://',
30                                   'uri'=>'http://testuri.org'));
31var_dump($x->Add(3,4));
32echo "ok\n";
33?>
34--EXPECT--
35int(7)
36ok
37