Неустранимая ошибка с NuSoap 1.94 с PHP 5.2.17, делающим вызов мыльного клиента

Я получаю сообщение об ошибке при вызове веб-сервера на основе xBase++, который действует как веб-служба (без использования WSDL), при попытке сделать вызов soapclient с помощью NuSoap 1.94 с PHP 5.2.17. Точно такой же код работает с NuSOAP 1.94 на PHP 4. Будем признательны за любые идеи или помощь!

Примечание (мне пришлось удалить https:// часть адресов из сообщения об ошибке ниже — я получал сообщение об ошибке, в котором говорилось, что мне нужно 10 репутации, чтобы опубликовать 2 ссылки или более)

Спасибо,

Салар

Неустранимая ошибка: исключение Uncaught SoapFault: [WSDL] SOAP-ОШИБКА: анализ WSDL: не удалось загрузить из «xxx.xxx.com:55055»: не удалось загрузить внешний объект «xxx.xxx.com:55055» в /hsphere/ 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', Array) #2 {main} добавлено в /hsphere/local/home/xxx/xxx.com/phpinvent/inc/functions /xmsg.php в строке 34

Вот код моей тестовой страницы и функция 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 *************************************************************************

person Salar Madadi    schedule 06.08.2013    source источник
comment
Не по теме, но имейте в виду, что PHP 5.2 не поддерживается уже несколько лет и имеет ряд известных ошибок безопасности, которые не будут исправлены. Вы должны сделать приоритетной попытку обновления до поддерживаемой версии. (и обратите внимание, что даже поддержка версии 5.3 почти закончилась!)   -  person Spudley    schedule 06.08.2013


Ответы (1)


Это довольно просто. Ваш веб-сервер не может видеть расположение, в котором размещен WSDL. Сможете ли вы попасть в это место, если скопируете URL-адрес WSDL и вставите его в свой браузер? Вы должны проверить правильность используемого вами URL-адреса и может ли ваш веб-сервер видеть это местоположение. Если нет, вам нужно будет исправить это, прежде чем он будет работать.

person Garry Welding    schedule 06.08.2013
comment
Гарри - сервер, на котором мы делаем вызов SOAP, не имеет WSDL - возможно ли использовать NuSOAP для выполнения вызова SOAP без использования WSDL? Казалось, что в PHP4 все работает нормально, а с PHP5 мы столкнулись только с проблемами. - person Salar Madadi; 06.08.2013
comment
Насколько я знаю, вам не нужен WSDL для использования NuSOAP, я просто подумал, что это может быть то, как он используется, глупое предположение. Вам необходимо убедиться, что конечная точка SOAP работает и доступна с сервера, с которого поступает запрос SOAP. - person Garry Welding; 07.08.2013
comment
@GarryWelding У меня точно такая же проблема. Мой запрос не WSDL. Как я могу проверить, работает ли конечная точка и доступна ли она? - person Aris; 18.09.2013
comment
Вам нужно будет зайти на сервер, с которого работает ваш скрипт, и попытаться получить доступ к службе через командную строку. Простой эхо-запрос на одну из конечных точек может показать, доступна она или нет. В противном случае вам придется самостоятельно создать запрос на завивку и попробовать его. - person Garry Welding; 18.09.2013