本文整理汇总了PHP中SoapClient::test方法的典型用法代码示例。如果您正苦于以下问题:PHP SoapClient::test方法的具体用法?PHP SoapClient::test怎么用?PHP SoapClient::test使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SoapClient
的用法示例。
在下文中一共展示了SoapClient::test方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSoapAction
public function testSoapAction()
{
ini_set("soap.wsdl_cache_enabled", "0");
$objSoapClient = new \SoapClient("http://127.0.0.1/rulestest/rulestest/web/app_dev.php/ws/GamificationAPI?wsdl", ['trace' => true, 'cache_wsdl' => WSDL_CACHE_NONE, 'soap_version' => SOAP_1_1, 'exceptions' => true, 'user_agent' => 'PHPSoapClient']);
$objSoapClient = new \SoapClient("http://localhost/rulestest/rulestest/web/app_dev.php/ws/GamificationAPI?wsdl");
try {
$result = $objSoapClient->test(1);
} catch (\Exception $ex) {
die("exception");
}
return new Response($result);
}
示例2: array
<?php
class AuthHeader
{
public $username;
public $password;
}
// -----
$options = array('location' => 'http://localhost/test/web-service/server/auth/SoapServer.php', 'uri' => 'http://localhost', 'exceptions' => true);
$Client = new SoapClient(null, $options);
// -----
$AuthHeader = new AuthHeader();
$AuthHeader->username = 'foo';
$AuthHeader->password = 'bar';
$Headers[] = new SoapHeader('http://localhost', 'AuthHeader', $AuthHeader);
$Client->__setSoapHeaders($Headers);
// -----
//$Result = $Client->sum(1,2);
try {
echo $Client->test();
//$Result = $Client->sum(1,2);
//echo $Result;
} catch (Exception $e) {
echo 'error';
}
示例3: test
public $var1;
}
class CT_A2 extends CT_A1
{
public $var2;
}
class CT_A3 extends CT_A2
{
public $var3;
}
// returns A2 in WSDL
function test($a1)
{
$a3 = new CT_A3();
$a3->var1 = $a1->var1;
$a3->var2 = "var two";
$a3->var3 = "var three";
return $a3;
}
$classMap = array("A1" => "CT_A1", "A2" => "CT_A2", "A3" => "CT_A3");
$client = new SoapClient(dirname(__FILE__) . "/bug36575.wsdl", array("trace" => 1, "exceptions" => 0, "classmap" => $classMap));
$a2 = new CT_A2();
$a2->var1 = "one";
$a2->var2 = "two";
$client->test($a2);
$soapRequest = $client->__getLastRequest();
echo $soapRequest;
$server = new SoapServer(dirname(__FILE__) . "/bug36575.wsdl", array("classmap" => $classMap));
$server->addFunction("test");
$server->handle($soapRequest);
echo "ok\n";
示例4: cookie
/**
* @test
*/
public function cookie()
{
$obj = new CurlSoapClient(null, array('location' => 'http://localhost:8000/tests/server.php', 'uri' => 'http://test-uri/', 'trace' => true));
$original_obj = new \SoapClient(null, array('location' => 'http://localhost:8000/tests/server.php', 'uri' => 'http://test-uri/', 'trace' => true));
$this->assertEquals(array(), $obj->__getCookies());
$this->assertEquals(array(), $original_obj->__getCookies());
$obj->__setCookie('CookieTest', 'HelloWorld');
$obj->__setCookie('CookieTest2', 'HelloWorld2');
$original_obj->__setCookie('CookieTest', 'HelloWorld');
$original_obj->__setCookie('CookieTest2', 'HelloWorld2');
$this->assertEquals(array('CookieTest' => array('HelloWorld'), 'CookieTest2' => array('HelloWorld2')), $obj->__getCookies());
$this->assertEquals(array('CookieTest' => array('HelloWorld'), 'CookieTest2' => array('HelloWorld2')), $original_obj->__getCookies());
$this->assertEquals(array(1, 'a', false), $obj->test(array(1, 'a', false)));
$this->assertEquals(array(1, 'a', false), $original_obj->test(array(1, 'a', false)));
// difference of CurlSoapClient from SoapClient [";" -> "; "]
$this->assertTrue(stripos($obj->__getLastRequestHeaders(), 'Cookie: CookieTest=HelloWorld; CookieTest2=HelloWorld2') !== false);
$this->assertTrue(stripos($original_obj->__getLastRequestHeaders(), 'Cookie: CookieTest=HelloWorld;CookieTest2=HelloWorld2') !== false);
}
示例5: SoapClient
<?php
$client = new SoapClient(NULL, array("location" => "test://", "uri" => "test://", "exceptions" => 0, "trace" => 1));
$client->test();
echo $client->__getLastRequest();
$client->__setSoapHeaders(new SoapHeader("test://", "HDR1"));
$client->test();
echo $client->__getLastRequest();
$client->test();
echo $client->__getLastRequest();
$client->__setSoapHeaders();
$client->test();
echo $client->__getLastRequest();
$client->__setSoapHeaders(array(new SoapHeader("test://", "HDR1"), new SoapHeader("test://", "HDR2")));
$client->test();
echo $client->__getLastRequest();
$h = array(new SoapHeader("test://", "HDR0"));
$client->__soapCall("test", array(), null, $h);
echo $client->__getLastRequest();
示例6: SoapClient
<?php
class foo
{
public $a = "a";
private $b = "b";
protected $c = "c";
}
$x = new SoapClient(NULL, array("location" => "test://", "uri" => "test://", "exceptions" => 0, "trace" => 1));
$x->test(new foo());
echo $x->__getLastRequest();
echo "ok\n";
示例7: SoapClient
<?php
ini_set("soap.wsdl_cache_enabled", 0);
$client = new SoapClient(null, array('location' => 'http://localhost/ifa/soap/', 'uri' => 'service.php', 'version' => SOAP_1_2));
var_dump($client->test());