nusoap implementation for opencart

两盒软妹~` 提交于 2019-12-11 06:23:41

问题


Hope that someone is familiar with OpenCart here. I have problem with my Nusoap implementation on OpenCart. This is my implementation

  1. I created a new library file called ws.php (I have the entire nusoap folder in system/library/)
<?php
final class Ws {

      public function __construct() {

          require_once('nusoap/nusoap.php');

  }

}
?>
  1. I created a controller file in catalog/controller/webservice/ws.php
<?php
class ControllerWebserviceWs extends Controller {
  private $error = array(); 

  function __construct($registry) {

      parent::__construct($registry);

      $this->load->library('ws');
      $ws = new Ws();

          $this->nusoap_server = new soap_server();
        $this->nusoap_server->configureWSDL("MemberWSDL",

"urn:MemberWSDL"); $this->nusoap_server->register( "selectMemberInfo", array( "id" => "xsd:int", ), array("return"=>"xsd:string"), "urn:MemberWSDL", "urn:MemberWSDL#selectMemberInfo", "rpc", "encoded", "Get member's info" ); }

  function index(){

      $this->nusoap_server->service(file_get_contents("php://input"));

  }

  function select_member_info() {
        function selectMemberInfo($member_id) {
          return 'hello';
        }

$this->nusoap_server->service(file_get_contents("php://input")); } } ?>

  1. This is my soap client residing on an application out of OpenCart

$nusoap_client=new nusoap_client("http://localhost/opencart/index.php?route=webservice/ws"); $id = 90001; if($nusoap_client->fault) { $text = 'Error: '.$nusoap_client->fault;

    }
    else
    {
        if ($nusoap_client->getError())
        {
            $text = 'Error: '.$nusoap_client->getError();
        }
        else
        {
          $row = $nusoap_client->call(
                'selectMemberInfo',
                array($id),
                'urn:MemberWSDL',
                'urn:MemberWSDL#selectMemberInfo'
            );
            echo

'

'.htmlspecialchars($nusoap_client->response,
ENT_QUOTES).'
'; } }

?>

And this is what I get

HTTP/1.1 500 Internal Server Error Server: Microsoft-IIS/5.1 Date: Tue, 04 Oct 2011 04:47:41 GMT Content-Type: text/xml; charset=ISO-8859-1 X-Powered-By: PHP/5.3.1 Set-Cookie: PHPSESSID=fas5fisb84rcs3g94njljhrhk4; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Set-Cookie: language=en; expires=Thu, 03-Nov-2011 04:47:41 GMT; path=/; domain=localhost Set-Cookie: currency=MYR; expires=Thu, 03-Nov-2011 04:47:41 GMT; path=/; domain=localhost Server: NuSOAP Server v0.7.3 X-SOAP-Server: NuSOAP/0.7.3 (1.114) Content-Length: 692

xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> SOAP-ENV:Clientmethod 'selectMemberInfo' not defined in service

Have anyone tried to implement Nusoap/SOAP in OpenCart or any idea what goes wrong in my implementation?

Thanks in advance.


回答1:


I have the same problem. But i realized that if you put the select_member_info() outside the main class, it is working!

I will write again as soon as i get a working solution.



来源:https://stackoverflow.com/questions/7644541/nusoap-implementation-for-opencart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!