请问php soap请求是如何使用的啊?
$wsdl ="https://www.xxx.com/services/test.svc?wsdl";
libxml_disable_entity_loader(false);
$opts = array(
'ssl' => array(
'verify_peer' => false
),
'https' => array(
'curl_verify_ssl_peer' => false,
'curl_verify_ssl_host' => false
)
);
$streamContext = stream_context_create($opts);
$client = new \SoapClient($wsdl,
array(
'stream_context' => $streamContext
));
echo '<pre>';print_r($client->__getFunctions());
echo '<pre>';print_r($client->__getTypes());
得到:
Array
(
[0] => AddRepairAppointmentResponse AddRepairAppointment(AddRepairAppointment $parameters)
[1] => AddFaultItemResponse AddFaultItem(AddFaultItem $parameters)
[2] => AddOrUpdateMemberSatisfactionResponse AddOrUpdateMemberSatisfaction(AddOrUpdateMemberSatisfaction $parameters)
[3] => AddCarinfoAssemblysResponse AddCarinfoAssemblys(AddCarinfoAssemblys $parameters)
)
Array
(
[0] => struct AddRepairAppointment {
ArrayOfRepairAppointment data;
}
[1] => struct ArrayOfRepairAppointment {
RepairAppointment RepairAppointment;
}
[2] => struct RepairAppointment {
string AppointNo;
string CellPhoneNumber;
string CustomerName;
string DealerCode;
string Expend1;
string Expend2;
string Expend3;
string Expend4;
string Expend5;
string IsWx;
string LicensePlate;
int Mileage;
string MotorSeries;
string MotorType;
dateTime PlanArriveDate;
string PlanArriveTime;
int RepairType;
int Status;
string VinCode;
}
[3] => struct AddRepairAppointmentResponse {
OperationResult AddRepairAppointmentResult;
}
[4] => struct OperationResult {
int Code;
string Message;
}
[5] => struct AddFaultItem {
ArrayOfFaultItem data;
}
[6] => struct ArrayOfFaultItem {
FaultItem FaultItem;
}
[7] => struct FaultItem {
string Code;
int Id;
int Level;
string Name;
int ParentId;
}
[8] => struct AddFaultItemResponse {
OperationResult AddFaultItemResult;
}
[9] => struct AddOrUpdateMemberSatisfaction {
ArrayOfMemberSatisfaction data;
}
[10] => struct ArrayOfMemberSatisfaction {
MemberSatisfaction MemberSatisfaction;
}
[11] => struct MemberSatisfaction {
int Attitude;
int Environment;
int Fee;
string Member_name;
string Message;
string Phone_no;
dateTime Review_time;
int Satisfaction;
string Settle_no;
int Skills;
int Time_liness;
string Vin_code;
}
[12] => struct AddOrUpdateMemberSatisfactionResponse {
OperationResult AddOrUpdateMemberSatisfactionResult;
}
[13] => struct AddCarinfoAssemblys {
ArrayOfCarinfoAssembly data;
}
[14] => struct ArrayOfCarinfoAssembly {
CarinfoAssembly CarinfoAssembly;
}
[15] => struct CarinfoAssembly {
string Batch_Code;
string Body_Num;
string Car_Material_Code;
string Color_Code;
string Engine_Num;
string Export_Code;
string Factory_Code;
string Gear_Num;
string Line_Name;
string Offline_Time;
string Online_Time;
string PT_Online_Time;
string Prd_Num;
string QC_Num;
string QC_Time;
string RS1;
string RS2;
string RS3;
string RS4;
string RS5;
string Remark;
string Sales_Code;
string To_Warehouse_Time;
int Trans_Mark;
string Vin_Batch_Code;
string Vin_Code;
string Year_Code;
}
[16] => struct AddCarinfoAssemblysResponse {
OperationResult AddCarinfoAssemblysResult;
}
[17] => int char
[18] => duration duration
[19] => string guid
)
然后请求:
$param = [
'AppointNo'=>'201905170111', //预约单号(车主俱乐部单号)
'CellPhoneNumber'=>'18888889999', //车主电话
'CustomerName'=>'李三',
'DealerCode' => '13885',
'Expend1' => '开新',
'Expend2' => '',
'Expend3' => '',
'Expend4' => '',
'Expend5' => '',
'IsWx' => '7',
'LicensePlate' => '粤AD91585',
'Mileage' => 5000,
'MotorSeries' => '',
'MotorType' => '',
'PlanArriveDate' => '2021-05-19',
'PlanArriveTime' => '13:00-14:00',
'RepairType' => 1,
'Status' => 1,
'VinCode' => 'LVM6A1G18JF072259'
];
//$param = json_encode($param,JSON_UNESCAPED_UNICODE);
$result = $client->AddRepairAppointment($param);
dd($result);
报错如图:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看着是没问题的. 需要打开 trace 看一下发送和请求的具体xml
我看类型说明, 参数应该是
['data' => [ [ 数据 ], [数据] ] ]
这种结构