opencart 的 nusoap 实施

发布于 2024-12-08 03:14:52 字数 3201 浏览 0 评论 0原文

希望这里有人熟悉OpenCart。我在 OpenCart 上实施 Nusoap 时遇到问题。这是我的实现,

  1. 我创建了一个名为 ws.php 的新库文件(我在 system/library/ 中有整个 nusoap 文件夹)
<前><代码>
  1. 我在catalog/controller/webservice/ws.php中创建了一个控制器文件
<前><代码>加载->library('ws'); $ws = new Ws(); $this->nusoap_server = newsoap_server(); $this->nusoap_server->configureWSDL("MemberWSDL",

"瓮:MemberWSDL"); $this->nusoap_server->注册( "选择会员信息", 大批( “id” => “xsd:int”, ), 数组(“返回”=>“xsd:字符串”), “瓮:会员WSDL”, “瓮:MemberWSDL#selectMemberInfo”, “rpc”, “编码”, 「获取会员信息」 ); }

 函数索引(){

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

  }

  函数 select_member_info() {
        函数 selectMemberInfo($member_id) {
          返回“你好”;
        }

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

  1. 这是我的肥皂客户端,驻留在 OpenCart 的应用程序上

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

<前><代码> } 别的 { if ($nusoap_client->getError()) { $text = '错误:'.$nusoap_client->getError(); } 别的 { $row = $nusoap_client->call( '选择会员信息', 数组($id), '瓮:会员WSDL', '瓮:MemberWSDL#selectMemberInfo' ); 回声

'

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

?>

这就是我得到的

HTTP/1.1 500 内部服务器错误 服务器:Microsoft-IIS/5.1 日期: 2011 年 10 月 4 日星期二 04:47:41 GMT 内容类型:text/xml; charset=ISO-8859-1 X-Powered-By: PHP/5.3.1 Set-Cookie: PHPSESSID=fas5fisb84rcs3g94njljhrhk4; path=/ 到期时间: 1981 年 11 月 19 日,星期四 08:52:00 GMT 缓存控制:无存储、无缓存、必须重新验证、 post-check=0,pre-check=0 Pragma:无缓存 Set-Cookie:语言=en; 过期=2011 年 11 月 3 日星期四 04:47:41 GMT;路径=/;域=本地主机 Set-Cookie:货币=MYR;过期=2011 年 11 月 3 日星期四 04:47:41 GMT; 路径=/;域=本地主机 服务器:NuSOAP 服务器 v0.7.3 X-SOAP-服务器: NuSOAP/0.7.3 (1.114) 内容长度: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:未定义客户端方法“selectMemberInfo” 服务中

OpenCart 中实现 Nusoap/SOAP 或者知道我的实现中出了什么问题?

提前致谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

黑凤梨 2024-12-15 03:14:52

我有同样的问题。但我意识到,如果您将 select_member_info() 放在主类之外,它就可以工作!

一旦找到可行的解决方案,我就会再次写信。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文