public function getMetadata($ids) { ini_set('soap.wsdl_cache_enable', 0); ini_set('soap.wsdl_cache_ttl', 0); $options = array('classmap' => array('campaign' => 'MY_Campaign')); $client = new LocalSoapClient("http://192.168.99.100/wsdl/lib.iita.gov.ua/MetaDataServ2.wsdl", array("trace" => 1, "exception" => 0, 'cache_wsdl' => WSDL_CACHE_NONE)); $ObjectXML = '<listId>'; foreach ($ids as $id) { $ObjectXML .= '<item>' . $id . '</item>'; } $ObjectXML .= '</listId>'; $ItemObject = new \SoapVar($ObjectXML, XSD_ANYXML); $result = $client->getEprint($ItemObject); // var_dump($client->__getLastRequest()); // var_dump($client->__getLastResponse()); $obj = simplexml_load_string($client->__getLastResponse()); //var_dump($result); $xml = $obj->children('http://schemas.xmlsoap.org/soap/envelope/')->Body->children('urn:MetaDataServ'); var_dump($xml); foreach ($xml->getEprintResponse->items->ResourcesList as $item) { // var_dump($item->TitleList->someArray->item); foreach ($item->TitleList->someArray->item as $title) { var_dump(base64_decode($title)); var_dump($title->attributes()->lang); } } // var_dump($xml->getEprintResponse->items->ResourcesList->TitleList); // var_dump($xml); // foreach($obj->children('http://schemas.xmlsoap.org/soap/envelope/')->Body->children('urn:MetaDataServ')->items->ResourcesList as $rate) // { // var_dump($rate); // } // var_dump($result->ArrayOfItems()); //var_dump($result->ResourcesList[0]->TitleList); die('eeeeeeeee'); return $result; }
{ public $a = "a"; private $b = "b"; protected $c = "c"; } function test($x) { return $x; } class LocalSoapClient extends SoapClient { function __construct($wsdl, $options) { parent::__construct($wsdl, $options); $this->server = new SoapServer($wsdl, $options); $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; } } $x = new LocalSoapClient(dirname(__FILE__) . "/bug30928.wsdl", array()); var_dump($x->test(new foo())); $x = new LocalSoapClient(dirname(__FILE__) . "/bug30928.wsdl", array("classmap" => array('testType' => 'foo'))); var_dump($x->test(new foo())); echo "ok\n";
} class B extends A { public $y; } function f($a) { return $a; } class LocalSoapClient extends SoapClient { function __construct($wsdl, $options) { parent::__construct($wsdl, $options); $this->server = new SoapServer($wsdl, $options); $this->server->addFunction("f"); } 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 LocalSoapClient(dirname(__FILE__) . "/classmap_extension_crash.wsdl", array('classmap' => array('A' => 'A', 'B' => 'B'))); $b = new B(); $b->x = 1; $b->y = 2; print_r($client->f($b));
<?php class hello_world { public function hello($to) { return 'Hello ' . $to; } } class LocalSoapClient extends SoapClient { function __construct($wsdl, $options) { parent::__construct($wsdl, $options); $this->server = new SoapServer($wsdl, $options); $this->server->setClass('hello_world'); } 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 LocalSoapClient(dirname(__FILE__) . "/bug29844.wsdl", array("trace" => 1)); var_dump($client->hello('davey'));
<?php $d = null; function test($x) { global $d; $d = $x; } class LocalSoapClient extends SoapClient { function __construct($wsdl, $options) { parent::__construct($wsdl, $options); $this->server = new SoapServer($wsdl, $options); $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; } } $x = new LocalSoapClient(dirname(__FILE__) . "/bug32776.wsdl", array("trace" => true, "exceptions" => false)); var_dump($x->test("Hello")); var_dump($d); var_dump($x->__getLastRequest()); var_dump($x->__getLastResponse()); echo "ok\n";
function __doRequest($request, $location, $action, $version, $one_way = 0) { return <<<EOF <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <getDIDAreaResponse xmlns="http://didx.org/GetList"> <soapenc:Array soapenc:arrayType="xsd:string[2]" xsi:type="soapenc:Array"> <item xsi:type="xsd:string">StateCode</item> <item xsi:type="xsd:string">description</item> </soapenc:Array> <soapenc:Array soapenc:arrayType="xsd:anyType[2]" xsi:type="soapenc:Array"> <item xsi:type="xsd:int">241</item> <item xsi:type="xsd:string">Carabobo</item> </soapenc:Array> <soapenc:Array soapenc:arrayType="xsd:anyType[2]" xsi:type="soapenc:Array"> <item xsi:type="xsd:int">243</item> <item xsi:type="xsd:string">Aragua and Carabobo</item> </soapenc:Array> <soapenc:Array soapenc:arrayType="xsd:anyType[2]" xsi:type="soapenc:Array"> <item xsi:type="xsd:int">261</item> <item xsi:type="xsd:string">Zulia</item> </soapenc:Array> </getDIDAreaResponse> </soap:Body> </soap:Envelope> EOF; } } $client = new LocalSoapClient(NULL, array('location' => 'test://', 'uri' => 'test://')); print_r($client->getDIDAreaResponse());
<?php class LocalSoapClient extends SoapClient { function __construct($wsdl, $options) { parent::__construct($wsdl, $options); } function __doRequest($request, $location, $action, $version, $one_way = 0) { return <<<EOF <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SOAP-ENV:Body><Price><Amount>3995</Amount><CurrencyCode>USD</CurrencyCode></Price></SOAP-ENV:Body></SOAP-ENV:Envelope> EOF; } } $client = new LocalSoapClient(dirname(__FILE__) . "/bug29795.wsdl", array("trace" => 1)); $ar = $client->GetPrice(); echo "o"; $client = new LocalSoapClient(dirname(__FILE__) . "/bug29795.wsdl", array("trace" => 1)); $ar = $client->GetPrice(); echo "k\n";
<?php ini_set("soap.wsdl_cache_enabled", 0); function getContinentList() { return array("getContinentListResult" => array("schema" => "<xsd:schema><element name=\"test\" type=\"xsd:string\"/></xsd:schema>", "any" => "<test>Hello World!</test><test>Bye World!</test>")); } class LocalSoapClient extends SoapClient { function __construct($wsdl, $options = array()) { parent::__construct($wsdl, $options); $this->server = new SoapServer($wsdl, $options); $this->server->addFunction("getContinentList"); } function __doRequest($request, $location, $action, $version, $one_way = 0) { echo $request; ob_start(); $this->server->handle($request); $response = ob_get_contents(); ob_end_clean(); echo $response; return $response; } } $client = new LocalSoapClient(dirname(__FILE__) . "/bug30106.wsdl"); var_dump($client->__getFunctions()); var_dump($client->__getTypes()); $x = $client->getContinentList(array("AFFILIATE_ID" => 1, "PASSWORD" => "x")); var_dump($x);
{ public $y; function __construct($a) { parent::__construct($a); $this->y = $a + 1; } } function f() { return new B(5); } class LocalSoapClient extends SoapClient { function __construct($wsdl, $options) { parent::__construct($wsdl, $options); $this->server = new SoapServer($wsdl, $options); $this->server->addFunction("f"); } 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 LocalSoapClient(dirname(__FILE__) . "/classmap003.wsdl", array('classmap' => array('A' => 'A', 'B' => 'B'))); print_r($client->f());
{ return 'header handler ' . ($this->auth ? 'called' : 'not called'); } } class LocalSoapClient extends SoapClient { function __construct($wsdl, $options) { parent::__construct($wsdl, $options); $this->server = new SoapServer($wsdl, $options); $this->server->setObject(new testSoap()); } function __doRequest($request, $location, $action, $version, $one_way = 0) { ob_start(); $this->server->handle($request); $response = ob_get_contents(); ob_end_clean(); return $response; } } $cl = new LocalSoapClient(dirname(__FILE__) . '/bug50762.wsdl', array('cache_wsdl' => WSDL_CACHE_NONE, 'trace' => true)); class authToken { public function __construct($token) { $this->authToken = $token; } } $cl->__setSoapHeaders(array(new SoapHeader('http://sova.pronto.ru/', 'authToken', new authToken('tokendata')))); echo $cl->testHeader('param') . PHP_EOL;
<?php function test() { return "жше"; // return utf8_encode("жше"); } class LocalSoapClient extends SoapClient { function __construct($wsdl, $options) { parent::__construct($wsdl, $options); $this->server = new SoapServer($wsdl, $options); $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; } } $x = new LocalSoapClient(NULL, array('location' => 'test://', 'uri' => 'http://testuri.org', 'encoding' => 'ISO-8859-1')); var_dump($x->test()); echo "ok\n";
<?php class LocalSoapClient extends SoapClient { function __doRequest($request, $location, $action, $version, $one_way = 0) { return <<<EOF <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="urn:qweb"> <SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" id="_0"> <ns1:HostInfo xsi:type="ns1:HostInfo"> <name xsi:type="xsd:string">blah blah some name field</name> <shortDescription xsi:type="xsd:string">This is a description. more blah blah blah</shortDescription> <ipAddress xsi:type="xsd:string">127.0.0.1</ipAddress> </ns1:HostInfo> </SOAP-ENV:Body> </SOAP-ENV:Envelope> EOF; } } $client = new LocalSoapClient(dirname(__FILE__) . "/bug30175.wsdl"); var_dump($client->qwebGetHostInfo());
$this->server = new SoapServer($wsdl, $options); $this->server->addFunction("Test"); } function __doRequest($request, $location, $action, $version, $one_way = 0) { echo "{$location}\n"; ob_start(); $this->server->handle($request); $response = ob_get_contents(); ob_end_clean(); return $response; } } $client = new LocalSoapClient(dirname(__FILE__) . "/bug31695.wsdl"); $client->Test("str"); $client = new LocalSoapClient(dirname(__FILE__) . "/bug31695.wsdl", array("location" => "test://1")); $client->Test("str"); $client->__soapCall("Test", array("arg1"), array("location" => "test://2")); $old = $client->__setLocation("test://3"); echo "{$old}\n"; $client->Test("str"); $client->Test("str"); $client->__setLocation($old); $client->Test("str"); $old = $client->__setLocation(); $client->Test("str"); $client->__setLocation($old); $client->Test("str"); $client->__setLocation(null); $client->Test("str"); var_dump($client->__setLocation());
<?php function test() { return 123.456; } class LocalSoapClient extends SoapClient { function __construct($wsdl, $options) { parent::__construct($wsdl, $options); $this->server = new SoapServer($wsdl, $options); $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; } } $x = new LocalSoapClient(NULL, array('location' => 'test://', 'uri' => 'http://testuri.org', "trace" => 1)); setlocale(LC_ALL, "sv_SE", "sv_SE.ISO8859-1"); var_dump($x->test()); echo $x->__getLastResponse(); setlocale(LC_ALL, "en_US", "en_US.ISO8859-1"); var_dump($x->test()); echo $x->__getLastResponse();
<?php function EchoString($s) { return $s; } class LocalSoapClient extends SoapClient { function __construct($wsdl, $options) { parent::__construct($wsdl, $options); $this->server = new SoapServer($wsdl, $options); $this->server->addFunction('EchoString'); } 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 LocalSoapClient(dirname(__FILE__) . "/bug29839.wsdl", array("trace" => 1)); $client->EchoString(array("value" => "hello", "lang" => "en")); echo $client->__getLastRequest(); echo $client->__getLastResponse(); echo "ok\n";
function __doRequest($request, $location, $action, $version, $one_way = 0) { return <<<EOF <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://www.grupos.com.br/ws/enturma/client"> <SOAP-ENV:Body> <getClientInfoFromDomainResponse SOAP-ENC:root="1"> <xsd:Result xsi:type="ns1:ClientType"> <id xsi:type="xsd:int">2</id> <address href="#i2"/> </xsd:Result> </getClientInfoFromDomainResponse> <xsd:address id="i2" xsi:type="ns1:ClientAddressType" SOAP-ENC:root="0"> <idClient xsi:type="xsd:long">2</idClient> <address href="#i3"/> </xsd:address> <address xsi:type="xsd:string" id="i3" SOAP-ENC:root="0">Test</address> </SOAP-ENV:Body> </SOAP-ENV:Envelope> EOF; } } ini_set("soap.wsdl_cache_enabled", 0); $SOAPObject = new LocalSoapClient(dirname(__FILE__) . '/bug38536.wsdl'); print_r($SOAPObject->test());
<?php function Add($x, $y) { return $x + $y; } class LocalSoapClient extends SoapClient { function __construct($wsdl, $options) { parent::__construct($wsdl, $options); $this->server = new SoapServer($wsdl, $options); $this->server->addFunction('Add'); } function __doRequest($request, $location, $action, $version, $one_way = 0) { ob_start(); $this->server->handle($request); $response = ob_get_contents(); ob_end_clean(); return $response; } } $x = new LocalSoapClient(NULL, array('location' => 'test://', 'uri' => 'http://testuri.org')); var_dump($x->Add(3, 4)); echo "ok\n";