/
bclient.php
47 lines (36 loc) · 1.08 KB
/
bclient.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* /bclient.php
*/
header("Content-Type: text/html; charset=utf-8");
header('Cache-Control: no-store, no-cache');
header('Expires: '.date('r'));
/**
* Пути по-умолчанию для поиска файлов
*/
set_include_path(get_include_path()
.PATH_SEPARATOR.'source');
/**
** Функция для автозагрузки необходимых классов
*/
function __autoload($class_name){
include $class_name.'.class.php';
}
ini_set('display_errors', 1);
ini_set("soap.wsdl_cache_enabled", "0");
error_reporting(E_ALL);
class Request{
public $title;
public $categoryId;
}
$product = new Request();
$product->title = 'Заголовок тестового продукта';
$product->categoryId = 20;
try{
$client = new SoapClient("http://{$_SERVER['HTTP_HOST']}/myservice.wsdl.php", array( 'soap_version' => SOAP_1_2));
echo '<pre>';
print_r($client->__getFunctions());//получаем список методов сервера
var_dump($client->getProductList($product));
}catch(SoapFault $e){
echo $e->getMessage();
}