2013-08-06 5 views
0

시도 할 때 웹 서비스 (WSDL을 사용하지 않음)로 작동하는 xBase ++ 기반 웹 서버를 호출 할 때 오류 메시지가 나타납니다. PHP 5.2.17에서 NuSoap 1.94를 사용하여 soapclient 호출을 작성하십시오. 이 똑같은 코드는 PHP 4의 NuSOAP 1.94에서 작동합니다. 어떤 아이디어 나 도움도 감사하겠습니다!PHP 5.2.17 NuSoap 1.94에서 치명적인 오류가 발생하여 SOAP 클라이언트 호출

주 (필자는 HTTPS를 제거했다 : 아래의 오류 메시지에서 주소의 // 부분 - 나는 2 개 링크 이상 게시 10 평판이 필요 없다는 오류 게시를 얻고 있었다)

감사합니다,

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

내 테스트 페이지의 코드이다, 그리고 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 ************************************************************************* 
+0

주제를 벗어나지 만, PHP 5.2는 현재 수년간 지원이 중단되었으며 수정되지 않은 알려진 보안 버그가 많이 있습니다. 지원되는 버전으로 업그레이드하는 것이 우선되어야합니다. (5.3도 거의 지원 종료 시점에 가까워졌습니다!) – Spudley

답변

0

이것은 매우 간단합니다. 웹 서버는 WSDL이 호스팅되는 위치를 볼 수 없습니다. WSDL URL을 복사하여 브라우저에 붙여 넣으면 위치를 알 수 있습니까? 사용중인 URL이 올바른지, 웹 서버가 해당 위치를 볼 수 있는지 여부를 확인해야합니다. 그렇지 않으면 효과가 나타나기 전에 치료할 필요가 있습니다.

+0

Garry - 우리가 SOAP 호출을하고있는 서버에는 WSDL이 없습니다 - NuSOAP을 사용하여 SOAP 호출을 할 수 있습니까? WSDL? PHP4에서 제대로 작동하는 것 같았습니다. PHP5에서만 문제가 발생했습니다. –

+0

NuSOAP을 사용하기 위해 WSDL이 필요 없다는 것을 알고있는 한, 나는 이것이 그것이 어떻게 소비되고 있었는지, 바보 같은 가정일지도 모른다고 생각했습니다. SOAP 요청이오고있는 서버에서 SOAP 엔드 포인트가 작동하고 액세스 가능한지 확인해야합니다. –

+0

@ GarryWelding 정확한 문제가 발생했습니다. 내 요청은 WSDL이 아닙니다. 엔드 포인트가 작동하고 액세스 가능한지를 어떻게 확인할 수 있습니까? – Aris