Question

I am developing this application that connects(using NUSOAP) to a web service in order to retrieve the content. When i submit the XML to the web service i get connected but the response take more than 30 seconds to reply. I have tried couple changes but the script still ends at 30 seconds mark with the following message(from the Nusoap object): cURL ERROR: 28: Operation timed out after 30015 milliseconds with 0 bytes received

this is the code(part of it) i am using:

$ch = curl_init();
    curl_setopt($ch, CURLOPT_TIMEOUT, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60);
    $client = new nusoap_client ( $this->getCreditcheckUrl(), true,false, false, false, false, 0, 300);

    $client->soap_defencoding = 'utf-8';
    $client->decode_utf8 = false;
    $client->operation = 'contentOrder';
    $client->useHTTPPersistentConnection (); // Uses http 1.1 instead of
    // 1.0
    $client->setUseCurl ( true );
    $client->loadWSDL ();
    $client->portName = "PrepareOrderPort";

    $client->setCredentials ( "", "", "certificate", array (
            // "cainfofile" => $sslPath . $caPath , //OPTIONAL
            "sslcertfile" => self::sslPath . self::sslcert,
            "sslkeyfile" => self::sslPath . self::sslcert,
            "passphrase" => "xxxxxxxxx",
            "certpassword" => "xxxxxxxx", // OPTIONAL
            "verifypeer" => False, // OPTIONAL
            "verifyhost" => 1  // OPTIONAL
    ) );
    $client->send($xmlRequest);

    $contentRaw = $client->responseData;

Is there a way to force to only stop when it gets a response?

Any help is greattly appreciated, i have been fighting this for weeks.

thank you.

Was it helpful?

Solution

You never do anything with with your curl handle ($ch) after setting the options on it - the nusoap client object doesn't know about it, so it has no effect.

Try using the setCurlOption method in nusoap_client - that should actually have the effect you want.

OTHER TIPS

Andrew i tried the following and IT WORKED...

$client->setCurlOption(CURLOPT_CONNECTTIMEOUT, 60);

thank you very much.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top