vb.net 消耗nusoap错误
vb.net consuming nusoap error
我正在构建一个 nusoap api 供我的 vb.net 应用程序使用 - 目前我正在尝试向我的客户端发送多行 mysql 数据,所以我构建了这个。
当我尝试在 Vb.net 中食用它时,我得到了经典:
...msdiscocodegenerator failed unable to import binding... Unable to import binding... from namespace
更多信息:错误状态:
Custom tool error: Unable to import WebService/Schema. Unable to import binding 'Testing_ServiceBinding' from namespace 'urn:Testing_Service'. Unable to import operation 'GetData'. The datatype 'urn:Testing_Service:return_array_php' is missing.
显然我的代码中有一个 VS 不喜欢的错误。 WSDL 检查员都说好,除了一些骆驼套
为什么我会收到该错误
require_once('lib/nusoap.php'); // basic include.. must go at the top
$SERVICE_NAMESPACE = "urn:Testing_Service"; // create a namespace to run under.
$server = new soap_server(); // the soap object from the include above.
// this has many input parameters but we only need two: the service name and the namespace
$server->configureWSDL('Testing_Service', $SERVICE_NAMESPACE);
////////////////////////
// //
// Mysql Test //
// //
////////////////////////
$server->wsdl->addComplexType(
'dataArray', // MySoapObjectArray
'complexType', 'array', '', 'SOAP-ENC:Array',
array(),
array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:return_array_php[]')), 'tns:return_array_php'
);
$server->register(
'GetData',
array(),
array('return'=>'tns:dataArray'),
$namespace,
false,
'rpc',
'encoded',
'mysql test data'
);
function GetData()
{
$servername = "localhost";
$username = "user";
$password = "password";
try {
$conn = new PDO("mysql:host=$servername;dbname=EMRFTD", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// echo "Connected successfully";
}
catch(PDOException $e)
{
// echo "Connection failed: " . $e->getMessage();
}
//already connected to pdo
// select statement.
$sql = $conn->prepare("SELECT c.RID AS RID, c.Utype AS Utype, c.Curgency as Curgency, firstname, lastname, putime, slocname, slocadd, sloccity, slocstate, Scene, Dest, dlocname, dlocadd, dloccity, dlocstate, s.fid AS sfid, s.name AS sname, s.faddress AS sfaddress, s.fcity AS sfcity, s.fstate AS sfstate, s.fcontnumb AS sfcontnumb, s.fcontname AS sfcontname, s.fcontract AS sfcontract, d.fid AS dfid, d.name AS dname, d.faddress AS dfaddress, d.fcity AS dfcity, d.fstate AS dfstate, d.fcontnumb AS dfcontnumb, d.fcontname AS dfcontname, d.fcontract AS dfcontract FROM calls c LEFT JOIN patients p ON c.Pnumb = p.pid LEFT JOIN facilities s ON c.Scene = s.fid LEFT JOIN facilities d ON c.Dest = d.fid WHERE 1 ORDER BY :orderby asc");
$sql->execute(array(':orderby' => "putime")); //leaving this so we can change the order programatically later
$results = $sql->fetchAll();
$counts = 0;
if ( count($results) ) {
foreach($results as $row) {
$result[$counts] = array(
"RID" => $row['RID'],
"Utype" => $row['Utype'],
"Curgency" => $row['Curgency']
);
$counts = $counts+1;
}
} else {
$result = null;
}
return $result;
}
//process request.
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
整个 mysql 事务运行良好,包括将数据放入数组中 - 执行 vardump 显示:
array(2) { [0]=> array(3) { ["RID"]=> string(4) "4117" ["Utype"]=> string(13) "ALS Ambulance" ["Curgency"]=> string(1) "1" } [1]=> array(3) { ["RID"]=> string(4) "4118" ["Utype"]=> string(13) "BLS Ambulance" ["Curgency"]=> string(1) "1" } }
为什么 VS 不消耗这个?
我发现我遇到的错误是由于缺少数组定义 - 我更改了复杂类型语句以包含两个定义:
$server->wsdl->addComplexType(
'DataArr', // the type's name
'complexType', // yes.. indeed it is a complex type.
'struct', // php it's a structure. (only other option is array)
'all', // compositor..
'',// no restriction
array(
'RID' => array('name'=>'RID','type'=>'xsd:string'),
'Utype' => array('name'=>'Utype','type'=>'xsd:string'),
'Curgency' => array('name'=>'Curgency','type'=>'xsd:string')
)// the elements of the structure.
);
// Here we need to make another complex type of our last complex type.. but now an array!
$server->wsdl->addComplexType(
'dataArray',//glorious name
'complexType',// not a simpletype for sure!
'array',// oh we are an array now!
'',// bah. blank
'SOAP-ENC:Array',
array(),// our element is an array.
array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:DataArr[]')),//the attributes of our array.
'tns:DataArr'// what type of array is this? Oh it's an array of mytable data
);
希望这对以后遇到类似错误的其他人有所帮助
我正在构建一个 nusoap api 供我的 vb.net 应用程序使用 - 目前我正在尝试向我的客户端发送多行 mysql 数据,所以我构建了这个。
当我尝试在 Vb.net 中食用它时,我得到了经典:
...msdiscocodegenerator failed unable to import binding... Unable to import binding... from namespace
更多信息:错误状态:
Custom tool error: Unable to import WebService/Schema. Unable to import binding 'Testing_ServiceBinding' from namespace 'urn:Testing_Service'. Unable to import operation 'GetData'. The datatype 'urn:Testing_Service:return_array_php' is missing.
显然我的代码中有一个 VS 不喜欢的错误。 WSDL 检查员都说好,除了一些骆驼套
为什么我会收到该错误
require_once('lib/nusoap.php'); // basic include.. must go at the top
$SERVICE_NAMESPACE = "urn:Testing_Service"; // create a namespace to run under.
$server = new soap_server(); // the soap object from the include above.
// this has many input parameters but we only need two: the service name and the namespace
$server->configureWSDL('Testing_Service', $SERVICE_NAMESPACE);
////////////////////////
// //
// Mysql Test //
// //
////////////////////////
$server->wsdl->addComplexType(
'dataArray', // MySoapObjectArray
'complexType', 'array', '', 'SOAP-ENC:Array',
array(),
array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:return_array_php[]')), 'tns:return_array_php'
);
$server->register(
'GetData',
array(),
array('return'=>'tns:dataArray'),
$namespace,
false,
'rpc',
'encoded',
'mysql test data'
);
function GetData()
{
$servername = "localhost";
$username = "user";
$password = "password";
try {
$conn = new PDO("mysql:host=$servername;dbname=EMRFTD", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// echo "Connected successfully";
}
catch(PDOException $e)
{
// echo "Connection failed: " . $e->getMessage();
}
//already connected to pdo
// select statement.
$sql = $conn->prepare("SELECT c.RID AS RID, c.Utype AS Utype, c.Curgency as Curgency, firstname, lastname, putime, slocname, slocadd, sloccity, slocstate, Scene, Dest, dlocname, dlocadd, dloccity, dlocstate, s.fid AS sfid, s.name AS sname, s.faddress AS sfaddress, s.fcity AS sfcity, s.fstate AS sfstate, s.fcontnumb AS sfcontnumb, s.fcontname AS sfcontname, s.fcontract AS sfcontract, d.fid AS dfid, d.name AS dname, d.faddress AS dfaddress, d.fcity AS dfcity, d.fstate AS dfstate, d.fcontnumb AS dfcontnumb, d.fcontname AS dfcontname, d.fcontract AS dfcontract FROM calls c LEFT JOIN patients p ON c.Pnumb = p.pid LEFT JOIN facilities s ON c.Scene = s.fid LEFT JOIN facilities d ON c.Dest = d.fid WHERE 1 ORDER BY :orderby asc");
$sql->execute(array(':orderby' => "putime")); //leaving this so we can change the order programatically later
$results = $sql->fetchAll();
$counts = 0;
if ( count($results) ) {
foreach($results as $row) {
$result[$counts] = array(
"RID" => $row['RID'],
"Utype" => $row['Utype'],
"Curgency" => $row['Curgency']
);
$counts = $counts+1;
}
} else {
$result = null;
}
return $result;
}
//process request.
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
整个 mysql 事务运行良好,包括将数据放入数组中 - 执行 vardump 显示:
array(2) { [0]=> array(3) { ["RID"]=> string(4) "4117" ["Utype"]=> string(13) "ALS Ambulance" ["Curgency"]=> string(1) "1" } [1]=> array(3) { ["RID"]=> string(4) "4118" ["Utype"]=> string(13) "BLS Ambulance" ["Curgency"]=> string(1) "1" } }
为什么 VS 不消耗这个?
我发现我遇到的错误是由于缺少数组定义 - 我更改了复杂类型语句以包含两个定义:
$server->wsdl->addComplexType(
'DataArr', // the type's name
'complexType', // yes.. indeed it is a complex type.
'struct', // php it's a structure. (only other option is array)
'all', // compositor..
'',// no restriction
array(
'RID' => array('name'=>'RID','type'=>'xsd:string'),
'Utype' => array('name'=>'Utype','type'=>'xsd:string'),
'Curgency' => array('name'=>'Curgency','type'=>'xsd:string')
)// the elements of the structure.
);
// Here we need to make another complex type of our last complex type.. but now an array!
$server->wsdl->addComplexType(
'dataArray',//glorious name
'complexType',// not a simpletype for sure!
'array',// oh we are an array now!
'',// bah. blank
'SOAP-ENC:Array',
array(),// our element is an array.
array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType'=>'tns:DataArr[]')),//the attributes of our array.
'tns:DataArr'// what type of array is this? Oh it's an array of mytable data
);
希望这对以后遇到类似错误的其他人有所帮助