开发者

nusoap implementation for opencart

开发者 https://www.devze.com 2023-04-10 05:09 出处:网络
Hope that someone is familiar with OpenCart here. I have problem with my Nusoap implementation on OpenCart. This is my implementation

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 syst开发者_开发知识库em/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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消