Joined: 28 Mar 2008 |
Posts: 1 |
|
|
|
Posted: Thu Mar 27, 2008 10:12 am |
|
|
|
|
|
Hi Guys,
I'm creating a server which uses a MySQL database to return some data to the client. It will return multiple rows of data so I have created the server as follows using complex types, however no results are returned. I know the SQL is correct and functioning and know my client is correct as doing it through soapUI for now.
Thanks,
Mark.
function getIssue($volume,$number)
{
require('../iqmag_db.inc');
$query = "SELECT d.title as departmenttitle, a.title, a.synopsis, a.text, a.author FROM iqmag_articles a, iqmag_departments d, iqmag_issue i WHERE a.issue = i.issue_number AND a.department_id = d.id AND i.volume = $volume AND i.number = $number";
$result = mysql_query($query);
$resultarray = array();
while ($row = mysql_fetch_assoc($result))
{
$resultarray[] = array('title' => $row['title'], 'departmenttitle' => $row['departmenttitle'], 'synopsis' => $row['synopsis'], 'text' => $row['text'], 'author' => $row['author']);
}
return $resultarray;
}
require('../nusoap/nusoap.php');
$server = new soap_server;
$server->configureWSDL('server', 'urn:iqissue');
$server->wsdl->addComplexType(
'RequestIssue',
'complexType',
'struct',
'all',
'',
array(
'volume' => array('name'=>'volume','type'=>'xsd:string'),
'number' => array('name'=>'number','type'=>'xsd:string'),
)
);
$server->wsdl->addComplexType(
'Issue',
'complexType',
'struct',
'all',
'',
array(
'resultarray' => array('name'=>'resultarray','type'=>'tns:ArticleArray'),
)
);
$server->wsdl->addComplexType(
'Article',
'complexType',
'struct',
'all',
'',
array(
'title' => array('name'=>'title','type'=>'xsd:string'),
'departmenttitle' => array('name'=>'title','type'=>'xsd:string'),
'synopsis' => array('name'=>'synopsis','type'=>'xsd:string'),
'text' => array('name'=>'text','type'=>'xsd:string'),
'author' => array('name'=>'author','type'=>'xsd:string'),
)
);
$server->wsdl->addComplexType(
'ArticleArray',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:Article[]')
),
'tns:Chapter'
);
$server->register("getIssue",
array('input' => 'tns:RequestIssue'),
array('return' => 'tns:Issue'),
'urn:iqissue',
'urn:iqissue#getIssue');
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA)
? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
?> |
|