如何让 NuSOAP 与 Symfony 1.4 一起工作?
我正在尝试使用 NuSOAP 在 symfony 中制作我的网络服务。我还创建了一个客户端用于测试目的。 我设法让它在我的 /web/ 目录中工作,但我无法从那里访问我的 symfony 方法。 因此,我在前端应用程序中创建了一个新模块,并将 nuSOAP 服务器文件的内容复制到 indexSuccess.php 中。 当我尝试使用它时,我没有收到错误,但也没有结果,真正奇怪的是 $proxy->response 返回我的主页。
这是我的 indexSuccess.php
require_once ("../lib/soap/nusoap.php");
$server = new soap_server();
$namespace = "Webservices";
$server->wsdl = new wsdl();
$server->wsdl->schemaTargetNamespace = $namespace;
$server->configureWSDL("Webservices", "Webservices");
function getDemandes($partnerCode)
{
$demandesArray = array();
$demandeArray[] = array( 'id' => 5, 'poid_id' => 25, 'demande_type' => "Male" );
$demandeArray[] = array( 'id' => 8,'poid_id' => 21, 'demande_type' => "Female");
return $demandeArray;
}
$server->register(
'getDemandes',
array('partnerCode' => 'xsd:string'),
array('getDemandesResponse'=>'tns:ArrayOfDemandesDatas'),
$namespace,
false,
'rpc',
'encoded',
'Return requests'
);
$POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
$server->service($POST_DATA);
exit();
经过进一步研究,我收到错误 Response not of type text/xml: text/html; charset=utf-8
这并不奇怪,因为我在 $request ->; 中有我的默认布局。响应
,即使我使用 $this->layout(false); 禁用它
I'm trying to make my webservice in symfony with NuSOAP. I also made a client for test purpose.
I managed to make it work in my /web/ directory, but i can't access my symfony methods from there.
So i created a new module in my frontend app, and i copied the content of my nuSOAP server file into indexSuccess.php.
When i try to consume it, i get no error but also no results, and what's really strange is $proxy->response returning my homepage.
Here's my indexSuccess.php
require_once ("../lib/soap/nusoap.php");
$server = new soap_server();
$namespace = "Webservices";
$server->wsdl = new wsdl();
$server->wsdl->schemaTargetNamespace = $namespace;
$server->configureWSDL("Webservices", "Webservices");
function getDemandes($partnerCode)
{
$demandesArray = array();
$demandeArray[] = array( 'id' => 5, 'poid_id' => 25, 'demande_type' => "Male" );
$demandeArray[] = array( 'id' => 8,'poid_id' => 21, 'demande_type' => "Female");
return $demandeArray;
}
$server->register(
'getDemandes',
array('partnerCode' => 'xsd:string'),
array('getDemandesResponse'=>'tns:ArrayOfDemandesDatas'),
$namespace,
false,
'rpc',
'encoded',
'Return requests'
);
$POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
$server->service($POST_DATA);
exit();
After further research I get the error Response not of type text/xml: text/html; charset=utf-8
whitch is not surprising because i have my default layout in the $request -> response
, even if i disable it with $this->layout(false);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许您应该选择一个更好地集成到 Symfony 中的选项。例如,有 ckWebservicePlugin 。该插件与 Symfony 紧密集成,是比使用 NuSOAP 更好的选择。
Maybe you should choose an option that is better integrated in Symfony. There is the ckWebservicePlugin for example. This plugin is tightly integrated in Symfony and would be a far better choice than using NuSOAP.