I am working on SOAP for web services from 3rd party server. Now some times the 3rd party server is not working, and it takes more time to get the data.
If I don’t get response from 3rd party server in 20 sec.
I want to ignore the 3rd party server and execute the rest of the web page.
How can I timeout SOAP. Please any one help me.
Thanks .
SOAP - Timeout.
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
-
vilvendhan
- Forum Newbie
- Posts: 5
- Joined: Thu Apr 19, 2007 6:21 am
Re: SOAP - Timeout.
I am not using library like NuSOAP. This is the my code. Help me
Thanks
Code: Select all
<?php
function ProductSearch( $hostname, $siteId ,$key ) {
try {
$productClient = new
SoapClient("https://thirdpartyserver.com",
array(
'trace' => 1,
'soap_version' => SOAP_1_1,
'style' => SOAP_DOCUMENT,
'encoding' => SOAP_LITERAL);
$results = $productClient->search(array(
"developerKey" => $developerKey,
"websiteId" => $websiteId,
"advertiserIds" => '',
"keywords" => $key,
"serviceableArea" => '',
"upc" => '',
"manufacturerName" =>'',
"manufacturerSku" => '',
"advertiserSku" => '',
"lowPrice" => '',
"highPrice" => '',
"lowSalePrice" => '',
"highSalePrice" => '',
"currency" => 'USD',
"isbn" => '',
"sortBy" => 'Price',
"sortOrder" => '',
"startAt" => 0,
"maxResults" =>10)
);
// give the user a nice message about the results
print "Your product search for '$key' generated $results->totalResults results\n";
// iterate through the results and display them to the user
echo "Displaying the first 10 results returned\n";
print_r($results);
echo "\n";
// if something goes wrong show the user a nice message
} catch (Exception $e){
echo "There was an error with your request or the service is unavailable.\n";
print_r ($e);
}
}
//--------- Variable Declarations --------//
$hostname = 'xxxx';
$developerKey ="xxxx";
$websiteId = "xxxx";
$ini = ini_set("soap.wsdl_cache_enabled","0");
//--------- Begin Script Execution --------//
ProductSearch( $hostname, $developerKey, $websiteId,$key );
?>