希望有人熟悉OpenCart。我在OpenCart上的Nusoap实现有问题。这是我的实现
<?php final class Ws { public function __construct() { require_once('nusoap/nusoap.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",
“瓮:MemberWSDL”); $这 - &GT; nusoap_server-&GT;寄存器( “selectMemberInfo” 阵列( “id”=&gt; “XSD:INT” ) 阵列( “返回”=&gt; “中的xsd:字符串”), “瓮:MemberWSDL” “瓮:MemberWSDL#selectMemberInfo” “RPC”, “编码”, “获取会员的信息” ); }
function index(){ $this->nusoap_server->service(file_get_contents("php://input")); } function select_member_info() { function selectMemberInfo($member_id) { return 'hello'; }
$这 - &GT; nusoap_server-&GT;服务(的file_get_contents( “PHP://输入”)); } } ?&GT;
$ nusoap_client =新 nusoap_client( “HTTP://localhost/opencart/index.php路线= web服务/ WS”); $ id = 90001;如果($ nusoap_client-&GT;故障) { $ text ='错误:'。$ nusoap_client-&gt; 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).''; } }
&GT;
这就是我得到的
HTTP / 1.1 500内部服务器错误服务器:Microsoft-IIS / 5。1日期: 星期二,04十月2011 04:47:41 GMT内容类型:text / xml; charset = ISO-8859-1 X-Powered-By:PHP / 5.3.1 Set-Cookie: PHPSESSID = fas5fisb84rcs3g94njljhrhk4; path = / Expires:1981年11月19日星期四 08:52:00 GMT Cache-Control:无存储,无缓存,必须重新验证, post-check = 0,pre-check = 0 Pragma:no-cache Set-Cookie:language = en; expires =星期四,03-Nov-2011 04:47:41 GMT;路径= /;域本地主机= Set-Cookie:货币= MYR; expires =星期四,03-Nov-2011 04:47:41 GMT; 路径= /; domain = localhost服务器:NuSOAP Server v0.7.3 X-SOAP-Server: 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/” &GT; SOAP-ENV:未定义Clientmethod'selectMemberInfo' 在服务中
有没有人试图在OpenCart中实现Nusoap / SOAP,或者知道我的实现出了什么问题?
提前致谢。
答案 0 :(得分:0)
我有同样的问题。但我意识到,如果你把select_member_info()
放在主类之外,它就可以了!
一旦我找到有效的解决方案,我会再次写信。