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; }
<?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 $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";
<?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";