2013-10-14 2 views
0

이 내가HTTPS를 웹 서비스 PHP를

<?php 
    ini_set('soap.wsdl_cache_enabled',0); 
    ini_set('soap.wsdl_cache_ttl',0); 

    $soap_server = new SoapServer('Notification.wsdl'); 
    $soap_server->addFunction('Notify'); 

    function Notify($message) 
    { 
     return array('message' => $message); 
    } 

    $soap_server->handle(); 


    ?> 

이 그리고이 오류를 던지고 것입니다 내 클라이언트 코드입니다 서버 코드는 호스트에 연결할 수 없습니다지고 보관하십시오. 엔드 포인트는 https입니다. wsdl 파일은 로컬입니다.

<?php 


    $context = stream_context_create(array(

     'https' => array(
     'cafile' => 'APX_WS_API1.cer', 
     'verify_peer' => true 
    ) 
    )); 

    $soap_client = new SoapClient('http://localhost:8888/Receiver/Notification.wsdl', 
     array('stream_context' => $context,'local_cer' => 'APX_WS_API1.cer')); 

    try{ 
    $result = $soap_client->__soapCall('Notify',array('message' => 'Hello World')); 
    echo $result; 
     }catch(SoapFault $e){ 
     echo "Error: " . $e->faultstring; 
     } 


     ?> 

누군가 내가 뭘 잘못하고 있는지 말해 줄 수 있습니까? 미리 감사드립니다.

+0

새로운 SoapClient ('http : // loc..' =>'새로운 SoapClient ('https : // loc..') 컨텍스트에 https 옵션을 지정해도 전송이 이루어지지 않을 때는 아무런 의미가 없습니다 .. – Wrikken

+0

빠른 응답을 위해 지금 나는 치명적인 오류가 발생합니다 : Uncaught SoapFault 예외 : [WSDL] SOAP-ERROR : WSDL 파싱 : 'https : // localhost : 8888/Receiver/Notification.wsdl'에서로드 할 수 없습니다. : 실패했습니다. 스택 트레이스 : # 0 C : \ wamp \ www \ Receiver \ soap_client.php : C : \ wamp \ www \ Receiver \ soap_client.php의 외부 엔티티 "https : // localhost : 8888/Receiver/Notification.wsdl" (13) : SoapClient -> SoapClient ('https : // localho ...', Array) # 1 {main}이 C : \ Wamp \ www \ Receiver \ soap_client.php에 13 행에 넣습니다. –

답변

1

인증서는 유효합니까? 그것은 그 사용자의 인증서가 유효하지 않은 의미 작동하는 경우

$context = stream_context_create(array(
      'ssl' => array(
       'verify_peer' => false, 
       'allow_self_signed' => true 
      ) 
     )); 

: 이 옵션을 사용해보십시오.

+0

로컬 컴퓨터를 연결할 수 있습니까? 원격 서버에 ping을 시도해보십시오. – Vincent

+0

누구든지 내가 뭘 잘못하고 있는지에 대해 조언을 해 줄 수 있습니까? 또는 지금 며칠. –

+0

웹 브라우저를 통해 http : // localhost : 8888/Receiver/Notification.wsdl에 액세스하려고 시도 했습니까? 그것은 유효한 wsdl 정의를 반환합니까? – Vincent

관련 문제