Hi Guys,
I was hoping someone could point me in the right direction. I have a nusoap server that I am trying to pass an array of data to. For now I just want to simply pass this array back, before handling this data, mainly to help my learning process. The problem in when I pass the data I get this error message:
Array
(
[faultcode] => SOAP-ENV:Server
[faultactor] =>
[faultstring] => unable to serialize result
[detail] =>
)
The following code is my nusoap server
require_once('lib/nusoap.php');
// Create the server instance
$server = new soap_server;
$server->debug_flag = false;
$server->configureWSDL('SyncroWebService', $namespace);
$server->wsdl->schemaTargetNamespace = $namespace;
//Create complex type for addProduct
$server->wsdl->addComplexType(
'addProductRequest',
'complexType',
'struct',
'all',
'',
array ( 'rmsId' => array('Name' => 'rmsId', 'type' => 'xsd:string'),
'departmentName' => array ('Name' => 'departmentName', 'type' => 'xsd:string'),
'categoryName' => array('Name' => 'categoryName', 'type' => 'xsd:string'),
'productName' => array('Name' => 'productName', 'type' => 'xsd:string'),
'productPrice' => array('Name' => 'productPrice', 'type' => 'xsd:float'),
'productQty' => array('Name' => 'productQty', 'type' => 'xsd:int'))
);
$server->wsdl->addComplexType(
'addProductRequestArray',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:addProductRequest[]')
),
'tns:addProductRequest'
);
$server->wsdl->addComplexType(
'addProductResponce',
'complextType',
'struct',
'all',
'',
array('addProductRequest' =>array('name'=>'addProductRequest', 'type'=>'tns:addProductRequestArray'))
);
// Register the method to expose
$server->register('addNewProduct', array('productName'=>'xsd:string'), array('return'=>'tsn:addProductResponce'), $nameSpace);
// Define the method as a PHP function
function addNewProduct($newProductDetails) {
}
// Use the request to (try to) invoke the service
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
The data that I am passing from my client is the following -
$params = array(
'rmsId' => '123456789',
'departmentName' => 'Britax',
'categoryName' => 'Car Seat',
'productName' => 'test Product For Britax Car Seat',
'productPrice' => 33.99,
'productQty' => 10
);
$result = $client->call('addNewProduct', $params);
Any help would be greatly appreciated!