NuSoap 1.94和PHP 5.2.17进行soap客户端调用时出现致命错误



当我尝试使用NuSoap 1.94和PHP 5.2.17对基于xBase++的web服务器进行soapclient调用时,在调用该服务器时收到一条错误消息,该服务器充当web服务(不使用WSDL)。这段完全相同的代码适用于PHP 4上的NuSOAP 1.94。任何想法或帮助都将不胜感激!

注意(我不得不从下面的错误消息中删除https://部分地址-我收到一个错误帖子,说我需要10个信誉才能发布2个或更多链接)

谢谢,

Salar

致命错误:未捕获SoapFault异常:[WSDL]SOAP-error:正在分析WSDL:无法从'xxx.xxx.com:555055'加载:无法在/hpshere/local/home/xxx.xxx.com/phpinvent/inc/functions/xmsg.php中加载外部实体"xxx.xxx.com/55055":34堆栈跟踪:#0/hpshere/local/home/xxx/xxx.com/phpinvent/inc/functions/xmsgphp(34):SoapClient->SoapClient('https://xxx.xxx...')#1/hpshere/local/home/xxx/xxx.com/phpinvent/xmsgtest.php(15):在第34行上的/hpshere/local/home/xxx/xxxx.com/phpinvento/inc/functions/XMsg.php中抛出的XMsg('OGIN',Array)#2{main}

这是我的测试页面的代码,以及xmsg函数:

<?php
ini_set('display_errors', 'On');
ini_set('default_socket_timeout', 300);
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// include configuration
require_once('inc/config.php');
require_once('inc/nusoap/nusoap.php'); // include the NuSOAP classes
$xmsg_param[0][0] = "userid";
$xmsg_param[0][1] = "TEST";
$xmsg_param[1][0] = "password";
$xmsg_param[1][1] = "TEST";
$result = XMsg("LOGIN", $xmsg_param);
echo("<br>resulttxt: ".$result['xmsg_resulttxt']);
echo("<br>Sessionid: ".$result['sessionid']);
?>
<?php
// XMsg *************************************************************************
// This function is used to send a message through the robust, connectionless message system
function XMsg($xm_type, $xm_parameters, $xm_target = XMSG_DEFAULT_GATEWAY, $xm_mode = XMSG_DEFAULT_MODE)
{
    // Parameters:
    // xm_type - C - mandatory – type of message being sent
    // xm_parameters - A - optional - 2 dimensional array of name/value pairs that will be sent to the target with the message
    // xm_target - C - optional - target - currently supports only URLs of AutoMate agents - defaults to gateway
    // xm_mode - C - optional - tokens that allow for modification of the message - currently defaults to #SOAP# to send via SOAP
    // Returns:
    // xm_result - A - array of name/value pairs returned from the target in same format as xm_target
    $xm_SOAPagent   = '';       // SOAP Envelope Object - Request
    $xm_SOAPresult  = '';       // SOAP Envelope Object - Response
    $xm_SOAPclass   = '';
    $xm_retrynum    = 0;        // Number of retries attempted
    $xm_retry       = true;     // Continue retrying?
    $xm_result      = Array();  // Array of results returned by XMsg
    $xm_numparams   = 0;        // Number of parameters passed to XMsg
    $xm_I           = 0;        // FOR Loop Counter
    // Initialize Parameters
    $xm_parameters  = (gettype($xm_parameters) == "array" ? $xm_parameters : array());
    // check if mandatory parameters are passed
    // xm_type must be character and not empty
    if (gettype($xm_type)=="string" && !empty($xm_type)) {
       switch($xm_mode)
       {
          case "SOAP":
              // open SOAP envelope and initialize
              echo("calling xm_target: ".$xm_target."<br>");
              $soapclient = new soapclient($xm_target);
              $soapparam = array();
              // create and pass xmsg structure - NOTE: this section is specialized to PHP
              $soapparam['xmsg_id'] = '';
              $soapparam['xmsg_source'] = '';
              $soapparam['xmsg_target'] = $xm_target;
              $soapparam['xmsg_session'] = $_SESSION['SESSIONID'];
              $soapparam['xmsg_userid'] = $_SESSION['USERID'];
              $soapparam['xmsg_websessid'] = session_id();
              $soapparam['xmsg_ip'] = $_SERVER['REMOTE_ADDR'];
              $soapparam['xmsg_status'] = 'SENT';
              $soapparam['xmsg_type'] = $xm_type;
              $soapparam['xmsg_result'] = '';
              $soapparam['xmsg_resulttxt'] = '';
              $soapparam['xmsg_date'] = date("m/d/y");
              $soapparam['xmsg_time'] = date("H:i:s");
              $soapparam['xmsg_datereceive'] = '';
              $soapparam['xmsg_timereceive'] = '';
              $soapparam['xmsg_dateresponse'] = '';
              $soapparam['xmsg_timeresponse'] = '';
              // count parameters and add to SOAP Envelope
              $xm_numparams = count($xm_parameters);
              for ($xm_I = 0; $xm_I < $xm_numparams; $xm_I++) {
                  echo("setting soapparam[".$xm_parameters[$xm_I][0]."] to :".$xm_parameters[$xm_I][1]);
                  $soapparam[$xm_parameters[$xm_I][0]] = $xm_parameters[$xm_I][1];
              }
              // SOAP retry loop start - retry until xm_retry is false - set to false when call succeeds or max # retries exceeded
              do {
                 // run remote SOAP call for RemoteCall as specified in
                 $xm_result = $soapclient->call('XMsg',$soapparam);
                 // check for fault
                 echo ("Fault: ".$xm_result['FAULT']."<br>");
                 echo ("1 Faultcode: ".$xm_result['faultcode']."<br>");
                 if (empty($xm_result['faultcode'])) {
                     echo('<hr>'.'<pre>' . htmlspecialchars($soapclient->response, ENT_QUOTES) . '</pre>');
                     echo('<hr>'.'<pre>' . htmlspecialchars($soapclient->debug_str, ENT_QUOTES) . '</pre>');
                    $xm_retry  = false;
                    // update status / response date / time
                    $xm_result['xmsg_status'] = "RECEIVED";
                    $xm_result['xmsg_dateresponse'] = date("m/d/y");
                    $xm_result['xmsg_timeresponse'] = date("H:i:s");
                 } else {
                     echo("2 faultcode: ".$xm_result['faultcode']);
                 }
                 // SOAP Call retry handling
                 if ($xm_retry) {
                    // increase the SOAP comm retry counter to count the number of retries made
                    $xm_retrynum++;
                    // check if the maximum number of retries has been reached
                    if ($xm_retrynum <= XMSG_NUMRETRY) {
                       sleep(XMSG_RETRYDELAY); // delay for set number of seconds
                    } else {
                       $xm_retry = false;
                    }
                 }
              } while ($xm_retry);
            break;
        default:
          // no other message type handling currently
        }
    }
}
return $xm_result;
// XMsg *************************************************************************

这很简单。你的web服务器看不到WSDL所在的位置。如果你复制WSDL url并将其粘贴到浏览器中,你能找到这个位置吗?您应该检查您使用的URL是否正确,以及您的web服务器是否可以看到该位置。如果没有,你需要补救,它才会起作用。

最新更新