$AgemniWebServices = new SoapClient("");
$theusername = "";
$password = "";
$companyName = "";
$theusernamee = "fltest";
$fname = "FTEST";
$lname = "LTEST";
$phone = "8888888888";
$zip = "12345";
$areaid = "1";
$keyVals = array(
"Username" => "Username",
"FName" => "FName",
"LName" => "LName",
"password" => "password"
);
$valVals = array(
"Username" => $theusernamee,
"FName" => $fname,
"LName" => $lname,
"password" => "test"
);
$params = array(
'strUsername' => $theusername,
'strPassword' => $password,
'strCompanyName' => $companyName,
'objecttype' => '10',
"keys" => $keyVals,
"values" => $valVals
);
$resp = $AgemniWebServices->ValidateEntity($params);
$resp = $AgemniWebServices->CreateEntity($params);
var_dump($resp);
我收到错误消息:
object(stdClass)#6 (1) {
["ValidateEntityResult"]=> object(SoapVar)#8(4) {
["enc_type"]=> int(0)
["enc_value"]=> object(stdClass)#7 (11) {
["status"]=> string(5) "Error"
["description"]=> string(23) "[Username] is required."
["errorNumber"]=> int(1)
["statusCode"]=> string(9) "Succeeded"
["xmlResult"]=> string(39) ""
["EntityValidated"]=> bool(false)
["EntityCreated"]=> bool(false)
["EntityUpdated"]=> bool(false)
["EntityIDCreated"]=> int(0)
["InvoiceIdCreated"]=> int(0)
["isloggedIn"]=> bool(false)
}
["enc_stype"]=> string(15) "ExceptionReport"
["enc_ns"]=> string(44) "http://tempuri.org/AgemniWebService/Service1"
}
}
你有什么主意吗?
答案 0 :(得分:0)
这肯定是由于根据WSDL,数据数组结构不正确的事实。您应该明确使用WSDL来生成PHP,这在当今非常普遍。通过OOP方法,它可以帮助构造请求数据并轻松处理所有响应。
您应该看一下PackageGenerator项目,它可以真正帮助您处理此SOAP Web服务。