Php NuSoap,XML为空,无法';t解析
首先,我必须说我对使用NuSOAP的基于WSDL的Web服务是完全陌生的。我试图从我的soap服务器返回朋友列表数组。请按原样查找以下我的代码清单: 服务器:Php NuSoap,XML为空,无法';t解析,php,xml,web-services,wsdl,nusoap,Php,Xml,Web Services,Wsdl,Nusoap,首先,我必须说我对使用NuSOAP的基于WSDL的Web服务是完全陌生的。我试图从我的soap服务器返回朋友列表数组。请按原样查找以下我的代码清单: 服务器: //File includes omitted function getFriendList($test = ''){ $results = array(); $results[] = array('name' => 'XXXXA1', 'surname' => 'XXXXA2'); $results[
//File includes omitted
function getFriendList($test = ''){
$results = array();
$results[] = array('name' => 'XXXXA1', 'surname' => 'XXXXA2');
$results[] = array('name' => 'XXXXXB1', 'surname' => 'XXXXB2');
$results[] = array('name' => 'XXXXXC1', 'surname' => 'XXXXC2');
return $results;
}
//Create server instance
$server = new soap_server();
//Configure our WSDL
$server->configureWSDL('server', 'urn:server');
//Add our Complex Type data type since we want to return an array
$server->wsdl->addComplexType(
'Friend',
'complexType',
'struct',
'all',
'',
array(
'name' => array('name' => 'name', 'type' => 'xsd:string'),
'surname' => array('name' => 'surname', 'type' => 'xsd:string')
)
);
//Register our array as a response
$server->wsdl->addComplexType(
'FriendArray',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:Friend[]')
),
'tns:Friend'
);
//Register the actual function that retuns the array but in the
//return n field specify the complex type of array we added onto the wsdl
$server->register('getFriendList',
array('test' => 'xsd:string'),
array('return' => 'tns:FriendArray'),
'urn:server',
'urn:server#getFriendList',
'document',
'encoded',
'Fetch a list of friends as an array. If you\'re not here sorry.'
);
//Serve the service
$server->service($HTTP_RAW_POST_DATA = (!isset($HTTP_RAW_POST_DATA)) ? $HTTP_RAW_POST_DATA : '');
有了这个,我希望我做的每件事都是正确的。我遵循了标准程序,使它工作,但在静脉
在客户端,我在wsdl中使用了soap地址url,并将其附加了“?wsdl”,以便它动态地为我提供wsdl文件
例如:
//Client call
$client = new nusoap_client("http://soapserver.dev/webroot/part_three/server.php?wsdl", true);
我还在我的客户端对象上添加了一些口哨和铃铛,如下所示:
$client->soap_defencoding = 'UTF-8';
$client->decode_utf8 = false;
这似乎毫无帮助。我之前遇到过一个问题,因为我的函数不接受任何参数,而我的服务因为我没有在$client->call($name,$in,$out)中传递任何涉及输入的参数而终止。我最终提供了一个空数组,我得到了这个错误
这可能与寄存器函数的rpc/文档参数类型有关吗?
即使使用从服务器url保存的wsdl文件,我也会遇到同样的错误
谁能帮帮我吗?求你了