简体   繁体   English

NuSoap 1.94与PHP 5.2.17进行Soap客户端调用时发生致命错误

[英]Fatal error with NuSoap 1.94 with PHP 5.2.17 making a soap client call

I'm getting an error message when making a call to an xBase++ based web server that is acting as a web service (not using WSDL) when trying to make a soapclient call to it using NuSoap 1.94 with PHP 5.2.17. 尝试使用NuSoap 1.94和PHP 5.2.17对其进行作为Web服务的基于xBase ++的Web服务器(不使用WSDL)进行调用时收到错误消息。 This exact same code works with NuSOAP 1.94 on PHP 4. Any ideas or help would be appreciated! 此完全相同的代码可在PHP 4上与NuSOAP 1.94一起使用。任何想法或帮助将不胜感激!

Note (I had to remove the https:// part of the addresses from the error message below - I was getting an error posting saying I needed 10 reputation to post 2 links or more) 注意(我必须从下面的错误消息中删除地址的https://部分-我收到一条错误消息,说我需要10点信誉才能发布2个链接或更多链接)

Thanks, 谢谢,

Salar 撒拉族

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'xxx.xxx.com:55055' : failed to load external entity "xxx.xxx.com:55055" in /hsphere/local/home/xxx/xxx.com/phpinvent/inc/functions/xmsg.php:34 Stack trace: #0 /hsphere/local/home/xxx/xxx.com/phpinvent/inc/functions/xmsg.php(34): SoapClient->SoapClient(' https://xxx.xxx ...') #1 /hsphere/local/home/xxx/xxx.com/phpinvent/xmsgtest.php(15): XMsg('LOGIN', Array) #2 {main} thrown in /hsphere/local/home/xxx/xxx.com/phpinvent/inc/functions/xmsg.php on line 34 致命错误:未捕获的SoapFault异常:[WSDL] SOAP错误:解析WSDL:无法从'xxx.xxx.com:55055'加载:无法在/ hsphere /中加载外部实体“ xxx.xxx.com:55055” local / home / xxx / xxx.com / phpinvent / inc / functions / xmsg.php:34堆栈跟踪:#0 /hsphere/local/home/xxx/xxx.com/phpinvent/inc/functions/xmsg.php(34 ):SoapClient-> SoapClient(' https://xxx.xxx ...')#1 /hsphere/local/home/xxx/xxx.com/phpinvent/xmsgtest.php(15):XMsg('LOGIN',阵列)在第34行上的/hsphere/local/home/xxx/xxx.com/phpinvent/inc/functions/xmsg.php中抛出#2 {main}

Here's the code of my test page, and the xmsg function: 这是我的测试页和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 *************************************************************************

This is quite simple. 这很简单。 Your web server can't see the location the WSDL is hosted at. 您的Web服务器看不到WSDL托管的位置。 Can you hit the location if you copy the WSDL url and paste it into your browser? 如果您复制WSDL网址并将其粘贴到浏览器中,是否可以找到该位置? You should check that the URL you are using is correct, and whether your web server can even see that location. 您应该检查使用的URL是否正确,以及您的Web服务器是否可以看到该位置。 If not you will need to remedy that before it will work. 如果没有,您将需要对其进行补救,然后才能起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM