Example #1
0
<?php

function Test($param)
{
    return new SoapFault('Test', 'This is our fault: Ä');
}
class TestSoapClient extends SoapClient
{
    function __construct($wsdl, $opt)
    {
        parent::__construct($wsdl, $opt);
        $this->server = new SoapServer($wsdl, $opt);
        $this->server->addFunction('Test');
    }
    function __doRequest($request, $location, $action, $version, $one_way = 0)
    {
        ob_start();
        $this->server->handle($request);
        $response = ob_get_contents();
        ob_end_clean();
        return $response;
    }
}
$client = new TestSoapClient(NULL, array('encoding' => 'ISO-8859-1', 'uri' => "test://", 'location' => "test://", 'soap_version' => SOAP_1_2, 'trace' => 1, 'exceptions' => 0));
$res = $client->Test();
echo $res->faultstring . "\n";
echo $client->__getLastResponse();
Example #2
0
<?php

function Test($param)
{
    global $g;
    $g = $param->str;
    return $g;
}
class TestSoapClient extends SoapClient
{
    function __construct($wsdl, $opt)
    {
        parent::__construct($wsdl, $opt);
        $this->server = new SoapServer($wsdl, $opt);
        $this->server->addFunction('Test');
    }
    function __doRequest($request, $location, $action, $version, $one_way = 0)
    {
        ob_start();
        $this->server->handle($request);
        $response = ob_get_contents();
        ob_end_clean();
        return $response;
    }
}
$client = new TestSoapClient(dirname(__FILE__) . '/bug38067.wsdl', array('encoding' => 'ISO-8859-1'));
$str = 'test: Ä';
$res = $client->Test(array('str' => $str));
echo $str . "\n";
echo $res . "\n";
echo $g . "\n";
Example #3
0
function Test($param)
{
    global $g1, $g2;
    $g1 = $param->boolA;
    $g2 = $param->boolB;
    return 1;
}
class TestSoapClient extends SoapClient
{
    function __construct($wsdl)
    {
        parent::__construct($wsdl);
        $this->server = new SoapServer($wsdl);
        $this->server->addFunction('Test');
    }
    function __doRequest($request, $location, $action, $version, $one_way = 0)
    {
        ob_start();
        $this->server->handle($request);
        $response = ob_get_contents();
        ob_end_clean();
        return $response;
    }
}
$client = new TestSoapClient(dirname(__FILE__) . '/bug38055.wsdl');
$boolA = 1;
$boolB = '1';
$res = $client->Test(array('boolA' => $boolA, 'boolB' => $boolB));
var_dump($g1);
var_dump($g2);
Example #4
0
<?php

function Test($param)
{
    global $g;
    $g = $param->strA . "\n" . $param->strB . "\n";
    return $g;
}
class TestSoapClient extends SoapClient
{
    function __construct($wsdl)
    {
        parent::__construct($wsdl);
        $this->server = new SoapServer($wsdl);
        $this->server->addFunction('Test');
    }
    function __doRequest($request, $location, $action, $version, $one_way = 0)
    {
        ob_start();
        $this->server->handle($request);
        $response = ob_get_contents();
        ob_end_clean();
        return $response;
    }
}
$client = new TestSoapClient(dirname(__FILE__) . '/bug38004.wsdl');
$strA = 'test &amp; test';
$strB = 'test & test';
$res = $client->Test(array('strA' => $strA, 'strB' => $strB));
print_r($res);
print_r($g);