Joined: 12 Dec 2012 |
Posts: 7 |
Location: iran |
|
|
Posted: Mon Dec 31, 2012 3:31 am |
|
|
|
|
|
hi All
I use this cod but i can't return arry plz hellp me
<?php
require_once 'nusoap/nusoap.php';
$ns = 'http://localhost/mywsdl';
$server = new NuSOAP_Server();
$server->debug_flag = false;
$server->soap_defencoding = 'utf-8';
$server->decode_utf8 = false;
$server->configureWSDL('MyWSDL', $ns);
$server->wsdl->schemaTargetNamespace = $ns;
$server->wsdl->addComplexType(
'UserInfo',
'complexType',
'struct',
'all',
'',
array(
'ID' => array(
'name' => 'ID',
'type' => 'xsd:int'
),
'ProgeramName' => array(
'name' => 'ProgeramName',
'type' => 'xsd:string'
),
'ProgramVersion' => array(
'name' => 'ProgramVersion',
'type' => 'xsd:string'
),
'ScriptTF' => array(
'name' => 'ScriptTF',
'type' => 'xsd:string'
),
'SqlScript1' => array(
'name' => 'SqlScript1',
'type' => 'xsd:string'
),
'FileTF' => array(
'name' => 'FileTF',
'type' => 'xsd:string'
),
'FilePath1' => array(
'name' => 'FilePath1',
'type' => 'xsd:string'
)
)
);
$server->wsdl->addComplexType(
'Users',
'complexType',
'array',
'',
'SOAP-ENC:Array',
array(),
array(
array(
'ref'=> 'SOAP-ENC:arrayType',
'wsdl:arrayType' => 'tns:UserInfo[]' )
),
'tns:UserInfo'
);
$server->register(
'GetUserInfo', // Method Name
array('DataBaseName' => 'xsd:string' ,'SqlScript' => 'xsd:string','headers' => 'xsd:string'), // Input Parameters
array('return' => 'tns:Users'), // Output Parameters
// array('return' => 'xsd:string[]'),
$ns, // Namespace
$ns . '#GetUserInfo', // SOAPAction
'rpc', // Style
'encoded', // Use
'Get specific user info' // Documentation
);
function GetUserInfo($DataBaseName,$SqlScript ,$headers){
$DataBaseName= "=?UTF-8?B?".base64_encode($DataBaseName)."?=";
$SqlScript = "=?UTF-8?B?".base64_encode($SqlScript )."?=";
$headers= "=?UTF-8?B?".base64_encode($headers)."?=";
$result = array(
'ID' => null,
'ProgeramName' => null,
'ProgramVersion' => null ,
'ScriptTF' => null ,
'SqlScript1' => null ,
'FileTF' => null ,
'FilePath1' => null
);
$conn = new COM ("ADODB.Connection") or die("Cannot start ADO");
$connStr = "PROVIDER=Microsoft.Ace.OLEDB.12.0;Data Source=.\UpdateDB.mdb";
$conn->open($connStr); //Open the connection to the database
if($conn){
$sql=$SqlScript ;
$user=odbc_exec($conn, $sql);
if($user && mysql_num_rows($user) > 0)
{
$user = mysql_fetch_assoc($user);
}
odbc_close($conn);
$result = array(
'ID' => $user['ID'],
'ProgeramName' =>$user['ProgeramName'],
'ProgeramName' =>$user['ProgramVersion'],
'ScriptTF' => $user['ScriptTF'],
'SqlScript1' =>$user['SqlScript1'],
'FileTF' => $user['FileTF'],
'FilePath1' => $user['FilePath1']);
return $result;
//$conn->close();
}
}
$HTTP_RAW_POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
$server->service($HTTP_RAW_POST_DATA);
exit();
?> |
|