|
|
ทำการสร้าง web service เพื่อรับค่าจาก client เจอ error ตามรูป.. ไล่ตรวจสอบ code
ตาม ตัวอย่าง https://www.thaicreate.com/php/forum/078536.html (เอามาดัดแปลงรับค่าลง base)
code ..
Code (PHP)
<?php
ini_set('error_reporting', E_STRICT);
require_once("lib/nusoap.php");
include("config.inc.php"); // connect db
//Create a new soap server
$server = new soap_server();
//Define our namespace
$namespace = "http://localhost/wpwebservice/wpservice.php";
$server->wsdl->schemaTargetNamespace = $namespace;
//Configure our WSDL
$server->configureWSDL("revPayment");
//Register our method and argument parameters
$revPayIN = array(
'strPayid' => "xsd:string",
'strPayDate' => "xsd:string",
'strCusid' => "xsd:string",
'strIDCar' => "xsd:string",
'strAppID' => "xsd:string",
'strPayno' => "xsd:int",
'strPayvalue' => "xsd:float",
'strPayby' => "xsd:string",
'strPayform' => "xsd:string",
'strComment' => "xsd:string",
'strIScomplete' => "xsd:int",
'strCreateid' => "xsd:int",
'strCreatedate' => "xsd:string",
'strUpdateid' => "xsd:int",
'strUpdatedate' => "xsd:string",
'strBankpaydate' => "xsd:string"
);
$server->register('resultRevPayment',$revPayIN, array('return' => 'tns:ArrayOfString'));
$server->wsdl->addComplexType("ArrayOfString",
"complexType",
"array",
"",
"SOAP-ENC:Array",
array(),
array(array("ref"=>"SOAP-ENC:arrayType","wsdl:arrayType"=>"xsd:string[]")),
"xsd:string");
function resultRevPayment($strPayid,$strPayDate,$strCusid,$strIDCar,$strAppID,$strPayno,$strPayvalue,$strPayby,$strPayform,$strComment,$strIScomplete,$strCreateid,$strCreatedate,$strUpdateid,$strUpdatedate,$strBankpaydate)
{
// -- insert into tblpayment
$strSQL = "insert into tblpayment(paydate,cusid,idcar,appid,payno,payvalue,payby,payform,comment,iscomplete,createid,createdate,updateid,updatedate,bankpaydate,payid_asn,rec_createdate)";
$strSQL .=" values ";
$strSQL .="('".$strPayDate."','".$strCusid."','".$strIDCar."','".strAppID."','".strPayno."','".$strPayvalue."','".$strPayby."','".$strPayform."','".strComment."','".strIScomplete."' ";
$strSQL .=",'".$strCreateid."','".$strCreatedate."','".$strUpdateid."','".$strUpdatedate."','".$chkCTYPE5."','".$strBankpaydate."','".$strPayid."',now()) ";
// echo "chk pack head : ".$strSQL;
$result = mysql_query($strSQL);
$resultArray = array();
if ($result ){
array_push($resultArray,$strAppID);
array_push($resultArray,1);
array_push($resultArray,'Success');
}else{
array_push($resultArray,$strAppID);
array_push($resultArray,0);
array_push($resultArray,'Failed');
}
mysql_close($connection);
return $resultArray;
}
// Get our posted data if the service is being consumed
// otherwise leave this data blank.
$POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
// pass our posted data (or nothing) to the soap service
$server->service($POST_DATA);
exit();
?>
Tag : PHP, Web Service
|
|
|
|
|
|
Date :
2016-04-27 11:49:24 |
By :
miniONEII |
View :
877 |
Reply :
6 |
|
|
|
|
|
|
|
|
|