2012-07-26 3 views
2

opencart에서 nusoap webservice를 만들려고합니다. 이를 위해 내가 다운로드 nusoap 라이브러리가 시스템/라이브러리/lib 디렉토리로 복사 한 후 내가 localhost를 다음 난에 액세스하여 내 컨트롤러를 점검 한이opencart의 웹 서비스

<?php 
    class ControllerCheckoutCamero extends Controller { 
     public function index() { 
       //require_once('lib/nusoap.php'); 
       $this->load->library('lib/nusoap'); 


    // Create the server instance 
    $server = new soap_server(); 
    // Initialize WSDL support 
    $server->configureWSDL('hellowsdl', 'urn:hellowsdl'); 

    // Register the method to expose 
    $server->register('hello',    // method name 
     array('name' => 'xsd:string'),  // input parameters 
     array('return' => 'xsd:string'),  // output parameters 
     'urn:hellowsdl',      // namespace 
     'urn:hellowsdl#hello',    // soapaction 
     'rpc',        // style 
     'encoded',       // use 
     'Says hello to the caller'   // documentation 
    ); 
    // Define the method as a PHP function 
    function hello($name) { 
      return 'Hello, ' . $name; 
    } 
    // Use the request to (try to) invoke the service 
    $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; 
    $server->service($HTTP_RAW_POST_DATA);  



      } 
    } 
    ?> 

처럼 체크 아웃 모듈의 컨트롤러 클래스를 만들었습니다/myopencart/index.php에? 경로 = 체크 아웃/camero


나는이 enter image description here


같은 nusoap 기본 웹 서비스 페이지를 얻을 그러나 나는 그 PAG에 WSDL 링크를 클릭 할 때 전자, 나는 opnecart 홈 페이지로 리디렉션 얻을


나는 opencart 라우터가이 문제를 만든다고 생각하지만, 어떻게 처리 해야할지 모르겠다. 나는 opencart를 탐색하기 시작했다. 비슷한 질문을 here 발견했지만 적절한 대답을 찾지 못했습니다. 누구든지 조언을 줄 수 있습니다. 미리 감사드립니다

답변

0

나는 코드가 정확하다고 생각합니다. 는 내가 직접하려고했던 당신이 당신의 서비스에 대한 전체 URL을 넣어하지 않습니다 따라서 PHP_SELF를 사용합니다/myopencart/index.php에? 경로 = 체크 아웃/camero & WSDL

nusoap 코드를 localhost로 이동 한 경우에 작동합니다.

또한 클라이언트를 코딩 할 때 $ client = new nusoap_client ('http : //localhost/myopencart/index.php? route = checkout/camero & wsdl', true)를 사용하십시오. ...

도움이 되길 바랍니다.