public function indexAction() { $code = $this->_getParam('code'); try { $url = 'http://10.0.0.75/soap-re-1.0.php?wsdl'; $clientSOAP = new Zend_Soap_Client($url); $clientSOAP->sendCode($code); } catch (SoapFault $e) { echo $e->__toString(); } }
public function clientAction() { $client = new Zend_Soap_Client($this->_WSDL_URI); $this->view->add_result = $client->math_add(11, 55); $this->view->logical_not_result = $client->logical_not(true); $this->view->sort_result = $client->simple_sort(array("d" => "lemon", "a" => "orange", "b" => "banana", "c" => "apple")); }
public function authenticate() { $this->_authenticateSetup(); $dbSelect = $this->_authenticateCreateSelect(); $resultIdentities = $this->_authenticateQuerySelect($dbSelect); if (is_null($resultIdentities) || !isset($resultIdentities) || empty($resultIdentities)) { return $this->_authenticateValidateResultSet(array()); } $config = Zend_Registry::get('config'); $host = $config['auth']['adconnector']['host']; $salt = $config['auth']['adconnector']['salt']; $options = array('location' => $host, 'uri' => $host); $client = new Zend_Soap_Client($host, $options); $hash = md5($salt . $this->_identity . date('Y-m-d') . $this->_credential); $zendAuthCredentialMatchColumn = $this->_zendDb->foldCase('zend_auth_credential_match'); $adConnectorAuthValues = array('userName' => $this->_identity, 'password' => $this->_credential, 'hash' => $hash); try { $adconnector_result = $client->Authenticate($adConnectorAuthValues); } catch (Exception $e) { return $this->_authenticateValidateResultSet(array()); } $resultIdentity = array_shift($resultIdentities); $resultIdentity[$zendAuthCredentialMatchColumn] = $adconnector_result->AuthenticateResult->IsAuthenticated || $adconnector_result->AuthenticateResult->IsOldPassword; $resultIdentity['passwordExpired'] = false; if ($adconnector_result->AuthenticateResult->IsOldPassword) { $resultIdentity['passwordExpired'] = true; } $result = $this->_authenticateValidateResult($resultIdentity); return $result; }
/** * Get the HTTP Client for communication with the VERS SOAP service. * @return Zend_Http_Client */ public function getClient() { if (is_null($this->_client)) { $this->setClient(new Zend_Soap_Client($this->_wsdl)); $this->_client->setSoapVersion(SOAP_1_1); } return $this->_client; }
public function testObjectResponse() { $wsdl = $this->baseuri . "/server2.php?wsdl"; $client = new Zend_Soap_Client($wsdl); $ret = $client->request("test", "test"); $this->assertTrue($ret instanceof stdClass); $this->assertEquals("test", $ret->foo); $this->assertEquals("test", $ret->bar); }
/** * @test */ public function searchUsingWsdlFile() { $soapClient = new \Zend_Soap_Client($this->_getDomain() . $this->_getUrl() . '?wsdl'); $result = $soapClient->search('symfony', 'php'); $this->assertInstanceOf('stdClass', $result); $this->assertTrue($result->success); $this->assertNull($result->message); $this->assertInternalType('array', $result->results); $this->assertGreaterThan(0, count($result->results)); }
public function testGetOptions() { if (!extension_loaded('soap')) { $this->markTestSkipped('SOAP Extension is not loaded'); } $client = new Zend_Soap_Client(); $this->assertTrue($client->getOptions() == array('encoding' => 'UTF-8', 'soap_version' => SOAP_1_2)); $options = array('soap_version' => SOAP_1_1, 'wsdl' => dirname(__FILE__) . '/_files/wsdl_example.wsdl', 'classmap' => array('TestData1' => 'Zend_Soap_Client_TestData1', 'TestData2' => 'Zend_Soap_Client_TestData2'), 'encoding' => 'ISO-8859-1', 'uri' => 'http://framework.zend.com/Zend_Soap_ServerTest.php', 'location' => 'http://framework.zend.com/Zend_Soap_ServerTest.php', 'use' => SOAP_ENCODED, 'style' => SOAP_RPC, 'login' => 'http_login', 'password' => 'http_password', 'proxy_host' => 'proxy.somehost.com', 'proxy_port' => 8080, 'proxy_login' => 'proxy_login', 'proxy_password' => 'proxy_password', 'local_cert' => dirname(__FILE__) . '/_files/cert_file', 'passphrase' => 'some pass phrase', 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5); $client->setOptions($options); $this->assertTrue($client->getOptions() == $options); }
public static function getSoapClient() { ini_set("soap.wsdl_cache_enabled", "0"); $conf = Zend_Registry::get("pimcore_config_test"); $user = User::getById($conf->user); if (!$user instanceof User) { throw new Exception("invalid user id"); } $client = new Zend_Soap_Client($conf->webservice->wsdl . "&username="******"&apikey=" . $user->getPassword(), array("cache_wsdl" => false, "soap_version" => SOAP_1_2, "classmap" => Webservice_Tool::createClassMappings())); $client->setLocation($conf->webservice->serviceEndpoint . "?username="******"&apikey=" . $user->getPassword()); return $client; }
public function clientAction() { //need to consume other webservices $client = new Zend_Soap_Client("http://webteam/soap?wsdl"); $result1 = $client->ValidateUser("admin1", "pass1"); $this->view->result1 = $result1; $client2 = new Zend_Soap_Client("http://webteam/soap?wsdl"); $result2 = $client2->CreateStream($result1, "title", "description"); $this->view->result2 = $result2; $client3 = new Zend_Soap_Client("http://webteam/soap?wsdl"); $result3 = $client3->VerifyStream("admin1", $result2); $this->view->result3 = $result3; }
/** * Helper para pegar as imagens do webservice * */ public function GetImagemSoap($id) { // initialize SOAP client $options = array('location' => 'http://painel.local/webservice/index', 'uri' => 'http://painel.local/webservice/index'); try { $client = new Zend_Soap_Client(null, $options); return $client->getImageById($id); } catch (SoapFault $s) { die('ERROR: [' . $s->faultcode . '] ' . $s->faultstring); } catch (Exception $e) { die('ERROR: ' . $e->getMessage()); } }
public function performRequest($wsdl, $operation, $params, $options = array('encoding' => 'UTF-8'), $fullReponse = false) { if (!extension_loaded('soap')) { return 'Extension SOAP not found'; } if (!isset($options['soap_version'])) { $options['soap_version'] = SOAP_1_1; } $client = new Zend_Soap_Client($wsdl, $options); $soap_params = array(); foreach ($params as $param_name => $param_value) { preg_match('/^(.*)\\:(.*)$/', $param_name, $matches); if (count($matches) == 3) { if (!isset($soap_params[$matches[1]])) { $soap_params[$matches[1]] = array(); } $soap_params[$matches[1]][$matches[2]] = $param_value; } else { $soap_params[$param_name] = $param_value; } } try { // Set (Session) cookies before the call if ($this->allowCookies) { if (is_array($this->cookies)) { foreach ($this->cookies as $cookieName => $cookieValue) { $client->setCookie($cookieName, $cookieValue[0]); } } } // Perform the SOAP request $result = call_user_func_array(array($client, $operation), $soap_params); // Pick up any new cookies from the server if ($this->allowCookies) { $last_response = $client->getLastResponseHeaders(); $soapClt = $client->getSoapClient(); $this->cookies = array_merge($soapClt->_cookies, $this->cookies); } } catch (SoapFault $e) { trigger_error($e->getMessage()); return $e->getMessage(); } // Unless the full response result is specified, only reply the returned result, and not the "out" parameter results if (is_object($result) && !$fullReponse) { $result_name = $operation . 'Result'; if (isset($result->{$result_name})) { return $result->{$result_name}; } } return $result; }
private function processTest() { $client = new Zend_Soap_Client($this->url('soapserver|soap|WSDL')); $client->setWsdlCache(false); $class1 = new soapClassModel(); $class1->name = 'Vasi Tavue'; $class1->accountId = 1; $class1->classId = 6; $class1->level = array(7); $class1->type = 8; $class1->year = 2011; $class1->validityDate = '2013-08-31'; $class = new soapClassModel(); $class->name = 'Vasi Tavue'; $class->accountId = 1; $class->classId = 6; $class->level = array(7); $class->type = 8; $class->year = 2011; $class->validityDate = '2013-08-31'; $directeur = new soapDirectorModel(); $directeur->name = "jeanClaude"; $directeur->surname = "leCompte"; $directeur->mail = "*****@*****.**"; $directeur->gender = 1; $adress = new soapAddressModel(); $adress->address = "4 rue des cochons"; $adress->additionalAddress = ""; $adress->city = "Larochelle"; $adress->postalCode = "76788"; $school = new soapSchoolModel(); $school->name = "DesChamps"; $school->address = $adress; $school->director = $directeur; $account = new soapAccountModel(); $account->id = 1; $account->school = $school; try { $j = $client->createAccount($account); $i = $client->createClass($class); $k = $client->validateClass($class1); } catch (Exception $e) { echo $e; } echo '==='; var_dump($i); var_dump($j); var_dump($k); return _arNone(); }
public function soapcreateuserAction() { $client = new Zend_Soap_Client('http://front.zend.local/Wsserver/index/soap?wsdl'); $client->setHttpLogin('test2') ->setHttpPassword('test'); $userData = array( 'login' => testSoap, 'password' => sha1( 'soap' ), 'nom' => 'WS', 'prenom' => 'SOAP11', 'telephone' => '00000000', 'email' => 'jhkljhl', 'civilite' => 'M'); $return = $client->create( $userData ); var_dump( $return ); exit; }
/** * Finaliza o processo de impressao, enviando o documento para * impressora ou arquivo * * @return boolean * @throws ZendT_Exception_Error */ public function endDocument() { if (!$this->_idDocument) { throw new ZendT_Exception_Error('Para executar esse procedimento e preciso chamar os métodos startDocument e addContent '); } if ($this->_output == 'pdf') { $client = new Zend_Http_Client($this->_uriPhp . 'wsPrintServer/Pdf.php?IdDocument=' . $this->_idDocument, array('timeout' => 10 * 60)); $response = $client->request(); $pdf = $response->getBody(); $pos = strpos($pdf, '%PDF'); if (!$pos) { $pos = 0; } return substr($pdf, $pos); } elseif ($this->_output == 'raw') { $client = new Zend_Http_Client($this->_uriPhp . 'wsPrintServer/Raw.php?IdDocument=' . $this->_idDocument, array('timeout' => 10 * 60)); $response = $client->request(); return $response->getBody(); } else { $param = array(); $param['pIdDocument'] = $this->_idDocument; $result = $this->_client->EndDocument($param); if ($result->EndDocumentResult->ErrorCode) { throw new ZendT_Exception_Error('(' . $result->EndDocumentResult->ErrorCode . ') :: ' . $result->EndDocumentResult->ErrorMessage . ' :: Erro ao iniciar processo de impressão. '); } else { return true; } } }
/** * Constructor * * @param string $wsdl * @param array $options */ public function __construct($wsdl = null, $options = null) { // Use SOAP 1.1 as default $this->setSoapVersion(SOAP_1_1); parent::__construct($wsdl, $options); }
public function getValueToDb() { //$_server = new Ged_Service_FileSystem(); $param = new Ged_Service_FileSystem_ParamWrite(); if ($this->_value instanceof ZendT_File) { $param->fileName = $this->_value->getName(); $param->fileContent = base64_encode($this->_value->getContent()); $param->fileId = $this->_options['id']; $param->userId = $this->_options['user_id']; $param->parentId = $this->_options['parent_id']; $param->typeId = $this->_options['type_id']; $param->desc = $this->_options['desc']; $param->propName = $this->_options['prop_docto_name']; $param->userInc = Zend_Auth::getInstance()->getStorage()->read()->getId(); $_result = $this->_client->write('0ac618c3e7d9012b', $param, 'base64'); if ($_result->success == 0) { throw new ZendT_Exception($_result->message->message, $_result->message->code); } return $_result->id; } else { if ($this->_valueDb) { return $this->_valueDb; } else { if ($this->_options['id']) { $_result = $this->_client->remove('0ac618c3e7d9012b', $this->_options['id'], 1); if ($_result->success == 0) { throw new ZendT_Exception($_result->message->message, $_result->message->code); } } return null; } } }
/** * Local client constructor * * @param Zend_Soap_Server $server * @param string $wsdl * @param array $options */ function __construct(Zend_Soap_Server $server, $wsdl, $options = null) { $this->_server = $server; // Use Server specified SOAP version as default $this->setSoapVersion($server->getSoapVersion()); parent::__construct($wsdl, $options); }
/** * Constructor * @param string $wsdl URL to WSDL * @param string $username WSSE Username * @param string $password WSSE Password */ public function __construct($wsdl, $options = null, $username = null, $password = null) { parent::__construct($wsdl, $options); $this->soapClient = new WSSoapClient(array($this, '_doRequest'), $wsdl, array_merge($this->getOptions(), $options ? $options : array())); if ($username && $password) { $this->soapClient->setUsernamePassword($username, $password); } $this->setSoapClient($this->soapClient); }
/** * * @param array $options A array of config values * @param string $wsdl The wsdl file to use * @access public */ public function __construct(array $options = array(), $wsdl = 'input2.wsdl') { foreach (self::$classmap as $key => $value) { if (!isset($options['classmap'][$key])) { $options['classmap'][$key] = $value; } } parent::__construct($wsdl, $options); }
public function __call($name, $arguments) { $b = Kwf_Benchmark::start('soapCall', $name); $ret = parent::__call($name, $arguments); if ($b) { $b->stop(); } return $ret; }
/** * Constructor method * * Expects a configuration parameter. * * @param Enlight_Config $config */ public function __construct($config) { $wsdl = 'https://ipayment.de/service/3.0/?wsdl'; if ($config->get('ipaymentSandbox')) { $this->accountData = array('accountId' => '99999', 'trxuserId' => '99998', 'trxpassword' => '0', 'adminactionpassword' => '5cfgRT34xsdedtFLdfHxj7tfwx24fe'); } else { $this->accountData = array('accountId' => $config->get('ipaymentAccountId'), 'trxuserId' => $config->get('ipaymentAppId'), 'trxpassword' => $config->get('ipaymentAppPassword'), 'adminactionpassword' => $config->get('ipaymentAdminPassword')); } parent::__construct($wsdl, array('useragent' => 'Shopware ' . Shopware::VERSION)); }
/** * Init Soap client - connect to SOAP service * * @param string $endpoint * @throws Zend_Service_LiveDocx_Exception * @return void * @since LiveDocx 1.2 */ protected function _initSoapClient($endpoint) { try { #require_once 'Zend/Soap/Client.php'; $this->_soapClient = new Zend_Soap_Client(); $this->_soapClient->setWsdl($endpoint); } catch (Zend_Soap_Client_Exception $e) { #require_once 'Zend/Service/LiveDocx/Exception.php'; throw new Zend_Service_LiveDocx_Exception('Cannot connect to LiveDocx service at ' . $endpoint, 0, $e); } }
static function callCompileService($sourceCode) { try { My_Logger::log(__METHOD__ . " " . $sourceCode); $url = "http://localhost:8086/CompilerService/services/CompilerService?wsdl"; $client = new Zend_Soap_Client($url, array('encoding' => 'UTF-8')); $arg = new stdClass(); $arg->sourceCode = "public " . $sourceCode; //$arg->b = 11; $res = $client->compile($arg); My_Logger::log(__METHOD__ . " " . print_r($res, true)); //print_r($res); return $res->return; } catch (Exception $e) { $msg = $e->getMessage(); My_Logger::log(__METHOD__ . " service returned error: " . $msg); $cex = new CompilerException("Compiler service found errors: "); $cex->compiler_output = $msg; throw $cex; } }
/** * Constructor * @param string $serverurl * @param array $auth * @param array $options PHP SOAP client options - see php.net */ public function __construct($serverurl, $auth, $options = null) { $this->serverurl = $serverurl; $values = array(); foreach ($auth as $k => $v) { $values[] = "{$k}=" . urlencode($v); } $values[] = 'wsdl=1'; $this->auth = implode('&', $values); $this->wsdl = $this->serverurl . "?" . $this->auth; parent::__construct($this->wsdl, $options); }
public function clientAction() { // return; $mtime = microtime(); $mtime = explode(" ", $mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; ini_set("soap.wsdl_cache_enabled", 0); $client = new Zend_Soap_Client("http://sms.loc/ws/sms?wsdl"); try { $data = $client->text('C22CWF', "a3gtniwerfawkdhnako", '48510066024', 'test'); debug($data); } catch (SoapFault $s) { var_dump("SOAP Fault: (faultcode: {$s->faultcode}, faultstring: {$s->faultstring})"); } catch (Exception $e) { print "EXC:\n"; var_dump($e->getMessage()); } if ($client instanceof Zend_Soap_Client) { print "<pre>\n"; print "Request :\n" . htmlspecialchars($client->getLastRequest()) . "\n"; print "Response:\n" . htmlspecialchars($client->getLastResponse()) . "\n\n"; print "Request:\n" . $client->getLastRequestHeaders() . "\n"; print "Response:\n" . $client->getLastResponseHeaders() . "\n"; print "</pre>"; } $mtime = microtime(); $mtime = explode(" ", $mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = $endtime - $starttime; echo "<br /><h3>This page was created in " . $totaltime . " seconds</h3>"; }
/** * * @param WarehouseEntranceCollection $warehouseEntryCollection * @param LandedCost $landedCost * @return strClass */ public function createLandedCost(WarehouseEntranceCollection $warehouseEntryCollection, LandedCost $landedCost) { $docEntries = array(); while ($warehouseEntry = $warehouseEntryCollection->read()) { $docEntries[] = $warehouseEntry->getIdWarehouseEntrance(); } $parameters['DocEntries'] = array_values($docEntries); $parameters['landedCostSochi'] = $landedCost->toSAPArray(); // echo '<pre>'; // print_r($parameters); // die; return $this->soapClient->createLandedCost($parameters); }
/** * Keep track of all requests and their responses in a log file * @return Void */ protected function _logTraffic() { if ('testing' !== APPLICATION_ENV) { $lastRequest = $this->_client->getLastRequest(); $lastResponse = $this->_client->getLastResponse(); $filename = date('Y-m-d') . '-gofilex.log'; $logMessage = "\n"; $logMessage .= '[REQUEST]' . "\n"; $logMessage .= $lastRequest . "\n\n"; $logMessage .= '[RESPONSE]' . "\n"; $logMessage .= $lastResponse . "\n\n"; dump($filename, $logMessage); } }
/** * Perform a SOAP call * * @param string $name * @param array $arguments * @return mixed */ public function __call($name, $arguments) { /*$config = Zend_Registry::get('config'); $db = Zend_Db_Table::getDefaultAdapter(); $cm = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('soaplogger'); $write = new Zend_Log_Writer_Db($db, 'log.soap', $cm->getColumnMapping()); $cm->setWriter($write); $logger = $cm->getLogObject();*/ //$logger->setEventItem('method', $name); //$logger->setEventItem('params', serialize($arguments)); $soapInfo = array(); try { $result = parent::__call($name, $arguments); $soapInfo[] = ''; $soapInfo[] = $this->getLastMethod(); $soapInfo[] = $this->getLastRequestHeaders(); $soapInfo[] = $this->getLastResponseHeaders(); $soapInfo[] = $this->getLastRequest(); $soapInfo[] = $this->getLastResponse(); $soapInfoStr = implode("[zfdebug]", $soapInfo); $this->saveSoapDataInToFile($soapInfoStr); //$logger->setEventItem('result', json_encode($result)); /*if($config['webservice']['logxml']) { $logger->setEventItem('request', json_encode($this->getLastRequest())); $logger->setEventItem('response', json_encode($this->getLastResponse())); }*/ //$logger->log('Wykonano akcję '.$name,Zend_Log::INFO); return $result; } catch (Exception $e) { $soapInfo[] = ''; $soapInfo[] = $e->getMessage(); $soapInfoStr = implode("[zfdebug]", $soapInfo); $this->saveSoapDataInToFile($soapInfoStr); //$logger->setEventItem('result', $e->getMessage()); /*if($config['webservice']['logxml']) { $logger->setEventItem('request', json_encode($this->getLastRequest())); $logger->setEventItem('response', json_encode($this->getLastResponse())); }*/ //$logger->log('Wyjątek w akcji '.$name,Zend_Log::ERR); throw $e; } }
/** * Perform a SOAP call but first check for adding STS Token or fetch one * * @param string $name * @param array $arguments * @return mixed */ public function __call($name, $arguments) { /** * add WSSE Security header */ if ($this->_tokenService !== null) { // if login method we addWsseLoginHeader if (in_array('login', $arguments)) { $this->addWsseLoginHeader(); } elseif ($name == 'getTokens') { $this->addWsseTokenHeader($this->_tokenService->getLoginToken()); } else { $this->addWsseSecurityTokenHeader($this->_tokenService->getTokens()); } } return parent::__call($name, $arguments); }
/** * returns the internal soap client * if not allready exists we create an instance of * Zend_Soap_Client * * @final * @return Zend_Service_DeveloperGarden_Client_Soap */ public final function getSoapClient() { if ($this->_soapClient === null) { /** * init the soapClient */ $this->_soapClient = new Zend_Service_DeveloperGarden_Client_Soap($this->getWsdl(), $this->getClientOptions()); $this->_soapClient->setCredential($this->_credential); $tokenService = new Zend_Service_DeveloperGarden_SecurityTokenServer(array('username' => $this->_credential->getUsername(), 'password' => $this->_credential->getPassword(), 'environment' => $this->getEnvironment(), 'realm' => $this->_credential->getRealm())); $this->_soapClient->setTokenService($tokenService); } return $this->_soapClient; }