Jump to content

SOAP calls taking too long.


foinf

Recommended Posts

The pbx_soap() function call shown below is taking way too long to respond.

 

Here's the body of the soap_call has as suggested by the abstract code body given here :

 

https://wiki.snomone.com/index.php?title=Access_to_the_Database#Abstract_Code_to_access_the_pbxnsip_database

function pbx_soap($req) {

  $start = microtime(true);
  global $dbadr, $dbport, $dbdebug;
 

  $dbhandle = fsockopen($dbadr, $dbport, $errno, $errstr);
 
  if (!$dbhandle) {
    echo "error hash";
   if($dbdebug) echo "$errstr ($errno)<br>\n";
   return;
  }

  $request = "POST /soap.xml HTTP/1.1\r\n";
  $request .= "Content-Type: text/xml\r\n";
 
  $request .= "Content-Length: " . strlen($req) . "\r\n";
  $request .= "Connection: close\r\n\r\n";
  $request .= $req;
  //echo $request;
  //exit;
 

  fputs($dbhandle, $request);
 
 
  $data = "";
  $count=0;
  while(!feof($dbhandle)) {
      $count++;
    $data.=fread($dbhandle, 128);
  }
  
  fclose($dbhandle);

  $pos = strpos($data,"\r\n\r\n");
  if($pos != false) {
  $body = substr($data, $pos);
    return $body;
  }
 
 
} // pbx_soap

Every call takes about 6 seconds (As determined by using microtimers.)

 

Also, the following statistics show how much time is being spent on the pbx_soap calls GREATLY slowing down the web apps.

 

3oOVoZv.png

Link to comment
Share on other sites

Hello, thanks for your response. Could you provide a sample code or example or at least a few lines of code which Illustrate how to use the modern technique instead of using SOAP?

 

The documentation (which i have quoted as a link in the OP) only illustrated the call using soap.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...