Exemplo n.º 1
1
 public function sendSoapRequest($message)
 {
     $client = new nusoap_client(HOTEL_ENDPOINT, false);
     $client->setCredentials(USERNAME, PASSWORD);
     $result = $client->send($message, HOTEL_ENDPOINT);
     return json_encode($result);
 }
 function UserAccountStatus()
 {
     $contents = '<GetAccountStatus xmlns="https://vesta.ecordia.com"><submission xmlns:a="http://optimizer.ecordia.com/types/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><a:ApiKey>' . $this->apiKey . '</a:ApiKey></submission></GetAccountStatus>';
     $contents = $this->client->serializeEnvelope($contents);
     $endpoint = 'https://vesta.ecordia.com/IUserManagement/GetAccountStatus';
     $results = $this->client->send($contents, $endpoint, 0, 180);
     $this->results = $results;
     $this->requestHasBeenExecuted = true;
 }
    function GetAlternateKeywords($keyword)
    {
        $contents = '
		<GetKeywordAlternates xmlns="https://vesta.ecordia.com">
			<request xmlns:a="http://optimizer.ecordia.com/types/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
				<a:ApiKey>' . $this->apiKey . '</a:ApiKey>
				<a:SeedTerm>' . $keyword . '</a:SeedTerm>
			</request>
		</GetKeywordAlternates>
		';
        $contents = $this->client->serializeEnvelope($contents);
        $endpoint = 'https://vesta.ecordia.com/IContentAnalysis/GetKeywordAlternates';
        $results = $this->client->send($contents, $endpoint, 0, 180);
        $this->results = $results;
        $this->requestHasBeenExecuted = true;
    }
Exemplo n.º 4
0
function getStatus($refid)
{
    ini_set("soap.wsdl_cache_enabled", "0");
    //$mkey = '465A86C858B0293DD478D3D664E4B0CB18BC18C0332215CCF7D7C891CA25C3FAA4F5FC7CB187BFDA7233A720A747FB9FDEC866EB8D20D7C262287716F11C48A5';
    $mkey = 'CF82609ADB4A2352966649823625C1217BE486E1B23D4686621EFED077B0B42924B2098F0B36656BAC8B6008576BF05A254B244675B501DA3DF863311BF1BB75';
    $t_ref = $refid;
    //$t_ref = '12345678';
    //$p_id = '3996';
    $p_id = '3944';
    $hasval = $p_id . $t_ref . $mkey;
    $myHASH = hash("sha512", $hasval);
    $wsdlfile = "https://webpay.interswitchng.com/paydirect/services/webpayservice.svc?wsdl";
    $msg = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.interswitchng.com/" xmlns:web="http://schemas.datacontract.org/2004/07/WebPAY.Core.ServiceFramework.Contract"> <soapenv:Header/> <soapenv:Body> <ser:GetTransactionData> <ser:transactionQueryRequest> <web:Hash>' . $myHASH . '</web:Hash> <web:ProductId>' . $p_id . '</web:ProductId> <web:TransactionReference>' . $t_ref . '</web:TransactionReference> </ser:transactionQueryRequest> </ser:GetTransactionData> </soapenv:Body> </soapenv:Envelope>';
    //$s = new nusoap_client($wsdlfile);
    $s = new nusoap_client($wsdlfile, true);
    //$result = $s->call('GetTransactionData', $msg ,'http://services.interswitchng.com/','http://services.interswitchng.com/WebPayService/GetTransactionData');
    $do = $s->send($msg, 'http://services.interswitchng.com/WebPayService/GetTransactionData');
    $result = $s->responseData;
    $err = $s->getError();
    if ($err) {
        // Display the error
        echo '<h2>Network Timeout! </h2><pre></pre><b>Ooopsy! Kindly hit the button below and hit <b>accept/send/yes</b>  on all prompt request.</b><br /><br /><input type="button" value="Please Click here" onClick="document.location.reload(true);">';
    } else {
    }
    return $result;
}
    function GetAnalysis($title, $description, $content, $url)
    {
        $contents = '
		<GetAnalysis xmlns="https://vesta.ecordia.com">
			<request xmlns:a="http://optimizer.ecordia.com/types/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
				<a:ApiKey>' . $this->apiKey . '</a:ApiKey>
				<a:DocumentBody><![CDATA[' . $content . ']]></a:DocumentBody>
				<a:DocumentDescription><![CDATA[' . $description . ']]></a:DocumentDescription>
				<a:DocumentSampleUrl><![CDATA[' . $url . ']]></a:DocumentSampleUrl>
				<a:DocumentTitle><![CDATA[' . $title . ']]></a:DocumentTitle>
			</request>
		</GetAnalysis>
		';
        $contents = $this->client->serializeEnvelope($contents);
        $endpoint = 'https://vesta.ecordia.com/IContentAnalysis/GetAnalysis';
        $results = $this->client->send($contents, $endpoint, 0, 180);
        $this->results = $results;
        $this->requestHasBeenExecuted = true;
    }
 function GetSearchEngineLinks($terms, $searchType, $url)
 {
     $termText = '';
     foreach ($terms as $term) {
         $termText .= "<b:string><![CDATA[{$term}]]></b:string>";
     }
     $contents = '<GetSearchEngineResults xmlns="https://vesta.ecordia.com">
         <request xmlns:a="http://optimizer.ecordia.com/types/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
             <a:ApiKey>' . $this->apiKey . '</a:ApiKey>
             <a:SearchTerms xmlns:b="http://schemas.microsoft.com/2003/10/Serialization/Arrays">' . $termText . '</a:SearchTerms>
             <a:SearchType>' . $searchType . '</a:SearchType>
             <a:SubjectUrl><![CDATA[' . $url . ']]></a:SubjectUrl>
         </request>
     </GetSearchEngineResults>';
     $contents = $this->client->serializeEnvelope($contents);
     $endpoint = 'https://vesta.ecordia.com/IContentAnalysis/GetSearchEngineResults';
     $results = $this->client->send($contents, $endpoint, 0, 180);
     $this->results = $results;
     $this->requestHasBeenExecuted = true;
 }
Exemplo n.º 7
0
function getHotelResultsJson($location, $num_adults, $checkin_date, $checkout_date, $num_rooms = 1)
{
    $message = file_get_contents(dirname(__FILE__) . "/sample_requests/HotelSearchAvailabilityReqNew.xml");
    $message = str_replace("{TARGET_BRANCH}", TARGET_BRANCH, $message);
    $message = str_replace("{LOCATION}", $location, $message);
    $message = str_replace("{NUM_ADULTS}", $num_adults, $message);
    $message = str_replace("{CHECKIN_DATE}", $checkin_date, $message);
    $message = str_replace("{CHECKOUT_DATE}", $checkout_date, $message);
    $message = str_replace("{NUM_ROOMS}", $num_rooms, $message);
    $client = new nusoap_client(HOTEL_ENDPOINT, false);
    $client->setCredentials(USERNAME, PASSWORD);
    $result = $client->send($message, HOTEL_ENDPOINT);
    return json_encode($result);
}
    public function operation($type, $ref, $price = NULL, $parameters = NULL)
    {
        try {
            $client = new nusoap_client($this->_file);
            $result = $client->send('<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:mnop:acceptor:contract">
				<soapenv:Header>' . $this->_header . '</soapenv:Header>
				<soapenv:Body>
					<urn:cashManagementOperationRequest>
					 <urn:amount>' . (int) ((double) $price * 100) . '</urn:amount>
					 <urn:merchantSessionId></urn:merchantSessionId>
					 <urn:operationName>' . $type . '</urn:operationName>
					 <urn:operationSequence></urn:operationSequence>
					 <urn:operationOrigin></urn:operationOrigin>
					 <urn:requestVersion>' . $this->_requestVersion . '</urn:requestVersion>
					 <urn:operationParameters>' . $parameters . '</urn:operationParameters>
					 <urn:transactionReference>' . $ref . '</urn:transactionReference>
					</urn:cashManagementOperationRequest>
				</soapenv:Body>
			</soapenv:Envelope>');
        } catch (SoapFault $e) {
            echo $e->faultstring;
        } catch (Exception $e) {
            var_dump($e);
        }
        return $result;
    }
 /**
  * 
  * __run
  *
  * @access protected	
  * @param
  * @return	
  */
 protected function __run($xml_request, $soap_action, $GSD_err = FALSE)
 {
     //get service status
     $status_service = $this->CI->model_admin_system->check_service("OWS");
     $this->response_success = FALSE;
     $client = new nusoap_client($this->endpoint_url, true);
     $client->soap_defencoding = 'utf-8';
     $client->useHTTPPersistentConnection();
     //$proxy = $client->getProxy();
     $this->response = $client->send($xml_request, $this->base_request_file . $soap_action);
     if ($client->fault) {
         $this->response_success = FALSE;
     } else {
         // Check for errors
         $err = $client->getError();
         if ($err) {
             $this->response_error = $err;
             $this->response_success = FALSE;
             error_log("server encounter a problem while sending a request to " . $this->endpoint_url, 0);
             //if notification has not been sent
             if ($status_service->status == "active") {
                 $data["service"] = "OWS";
                 $data["status"] = "down";
                 $data["message"] = "server encounter a problem while sending a request";
                 $data["err"] = $err;
                 $email_cotent = $this->CI->load->view("email/OWS/server_system_health_error", $data, TRUE);
                 $this->CI->load->library('NY_emailer');
                 $this->CI->ny_emailer->set_message($email_cotent);
                 //notify administrators
                 $this->CI->ny_emailer->send("*****@*****.**", "SYSTEM NOTIFICATION - SERVICE OWS DOWN");
                 $this->CI->ny_emailer->send("*****@*****.**", "SYSTEM NOTIFICATION - SERVICE OWS DOWN");
                 $this->CI->model_admin_system->Update("OWS", "down");
             }
         } else {
             //if service is restore
             if ($status_service->status == "down") {
                 $data["service"] = "OWS";
                 $data["status"] = "active";
                 $data["message"] = "service OWS restored";
                 $email_cotent = $this->CI->load->view("email/OWS/server_system_health_error", $data, TRUE);
                 $this->CI->load->library('NY_emailer');
                 $this->CI->ny_emailer->set_message($email_cotent);
                 //notify administrators
                 $this->CI->ny_emailer->send("*****@*****.**", "SYSTEM NOTIFICATION - SERVICE OWS RESTORED");
                 $this->CI->ny_emailer->send("*****@*****.**", "SYSTEM NOTIFICATION - SERVICE OWS DOWN");
                 $this->CI->model_admin_system->Update("OWS", "active");
             }
             if (key_exists("!resultStatusFlag", $this->response["Result"])) {
                 if ($this->response["Result"]["!resultStatusFlag"] == "SUCCESS") {
                     $this->response_success = TRUE;
                 }
             }
             if (!$this->response_success) {
                 if (!key_exists("Text", $this->response["Result"])) {
                     $GSD_err = TRUE;
                 }
                 if ($GSD_err) {
                     if (key_exists("GDSError", $this->response["Result"])) {
                         $this->response_error = "<b>Error (code " . $this->response["Result"]["GDSError"]["!errorCode"] . ") </b><br />" . $this->response["Result"]["GDSError"]["!"];
                     } else {
                         $this->response_error = $this->response["Result"]["Text"]["TextElement"];
                     }
                 } else {
                     $this->response_error = $this->response["Result"]["Text"]["TextElement"];
                 }
             }
         }
     }
 }
Exemplo n.º 10
0
<com:CityOrAirport Code="LON" />
</air:SearchOrigin>
<air:SearchDestination>
<com:CityOrAirport Code="AMS" />
</air:SearchDestination>
<air:SearchDestination>
<com:CityOrAirport Code="CPH" />
</air:SearchDestination>
<air:SearchDepTime PreferredTime="2014-04-15" />
</air:SearchAirLeg>
<air:AirSearchModifiers>
<air:PreferredProviders>
<com:Provider Code="1G" />
</air:PreferredProviders>
</air:AirSearchModifiers>
<com:SearchPassenger Code="ADT" />
</air:LowFareSearchReq>
</soapenv:Body>
</soapenv:Envelope>
EOM;
$client = new nusoap_client($endpoint, false);
$client->setCredentials($username, $password);
$result = $client->send($message, $endpoint);
file_put_contents("data/lowfaresearch_resp.json_08mar", json_encode($result));
//echo '<h2>Request</h2>';
//echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
//echo '<h2>Response</h2>';
//echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
// Display the debug messages
//echo '<h2>Debug</h2>';
//echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
Exemplo n.º 11
0
 /**
  * Internal utility methods
  */
 private function call($service, $method, $params)
 {
     ini_set('memory_limit', '1024M');
     ini_set('max_execution_time', 1800);
     set_time_limit(0);
     $url = $this->wsdl_root . $service . '.asmx?wsdl';
     $timeout = 3000;
     $cache = new nusoap_wsdlcache($this->cache_dir, $timeout);
     $wsdl = $cache->get($url);
     // Set the WSDL
     if (is_null($wsdl)) {
         $wsdl = new wsdl($url, NULL, NULL, NULL, NULL, 0, $timeout, NULL, TRUE);
         $error = $wsdl->getError();
         $debug = $wsdl->getDebug();
         $wsdl->clearDebug();
         // Check for SOAP errors
         if (!empty($error)) {
             $this->errors[] = $error;
             if ($debug) {
                 $this->errors[] = '<pre>' . print_r($debug, TRUE) . '</pre>';
             }
             return FALSE;
         }
         $cache->put($wsdl);
     }
     // Send the SOAP request
     $params['securityPassword'] = $this->wsdl_keys[$service];
     $client = new nusoap_client($wsdl, 'wsdl', FALSE, FALSE, FALSE, FALSE, 0, $timeout);
     $client->setDebugLevel(0);
     // 0 - 9, where 0 is off
     $client->useHTTPPersistentConnection();
     if ($service == 'DataAccess' && $method == 'ExecuteStoredProcedure') {
         /*
          * See http://www.codingforums.com/archive/index.php/t-85260.html
          * and http://users.skynet.be/pascalbotte/rcx-ws-doc/nusoapadvanced.htm
          * for how to thwart the "got wsdl error: phpType is struct, but value is not an array"
          * error returned by nusoap when processing the response from $client->call()
          *
          * */
         $request = $client->serializeEnvelope(vsprintf('<ExecuteStoredProcedure xmlns="http://ibridge.isgsolutions.com/%s/">
                   <securityPassword>%s</securityPassword>
                   <name>%s</name>
                   <parameters>%s</parameters>
                   </ExecuteStoredProcedure>', array($service, $params['securityPassword'], $params['name'], $params['parameters'])));
         $response = $client->send($request, 'http://ibridge.isgsolutions.com/' . $service . '/' . $method, 0, $timeout);
     } else {
         $response = $client->call($method, $params);
     }
     $error = $client->getError();
     $debug = $client->getDebug();
     $client->clearDebug();
     // Check for SOAP errors
     if (!empty($error)) {
         $this->errors[] = $error;
         if ($debug) {
             $this->errors[] = '<pre>' . print_r($debug, TRUE) . '</pre>';
         }
         return FALSE;
     }
     // Process response
     $response = $response[$method . 'Result'];
     $data = NULL;
     if (strpos($response, '<') == 0) {
         // Some ISGweb methods return strings instead of XML
         libxml_use_internal_errors(TRUE);
         $response = preg_replace('/(<\\?xml[^?]+?)utf-16/i', '$1utf-8', $response);
         // Change encoding string to UTF8
         $response = utf8_encode($response);
         $response = $this->strip_invalid_xml($response);
         $obj = simplexml_load_string($response);
         $data = $response;
         $error = libxml_get_errors();
         // Check for XML parsing errors
         if (!empty($error)) {
             foreach ($error as $e) {
                 $this->errors[] = $e;
             }
             libxml_clear_errors();
             return FALSE;
         }
         $data = $this->object_to_array($obj);
         // Check for ISGweb errors (e.g. invalid data input, failure of service, etc.)
         if (array_key_exists('Errors', $data)) {
             $error = $data['Errors'];
             foreach ($error as $e) {
                 $this->errors[] = $e['@attributes']['Description'];
             }
             return FALSE;
         }
     } else {
         $data = $response;
     }
     return $data;
 }