【发布时间】:2015-06-22 17:32:06
【问题描述】:
尽管我对 php soap 概念很陌生,但我还是编写了一个程序来使用 SoapClient 与 Web 服务器通信。
这是我的 wsdl 链接: https://es.adpolice.gov.ae/TrafficInsurance/TrafficInsuranceServicesNew.asmx?wsdl
服务名称:CreateVehicleInsurancePolicy 链接:https://es.adpolice.gov.ae/TrafficInsurance/TrafficInsuranceServicesNew.asmx?op=CreateVehicleInsurancePolicy
我将我的程序托管在经过 ssl 认证的托管中。当它运行时,它会在soap body 响应(lngSerial)中生成响应。我想打印来自soap 标头的响应值( SoapHeaderOut)。
即intResponseCode,strArMsg,strEnMsg。
请指导我。下面我提供我正在使用的脚本。
<?php
ini_set("soap.wsdl_cache_enabled", "0");
ini_set("soap.wsdl_cache_ttl", "0");
class SOAPStruct
{
function __construct($user, $pass)
{
$this->userName = $user;
$this->Password = $pass;
}
}
$service = new SoapClient("https://es.adpolice.gov.ae/TrafficInsurance/TrafficInsuranceServicesNew.asmx?wsdl");
$auth = new SOAPStruct('username','password');
$header = new SoapHeader("http://adpolice.gov.ae/TrafficInsurance/TrafficInsuranceServices.asmx","SoapHeaderIn",$auth,true);
$service->__setSoapHeaders($header);
$param = array('lngInsuranceCompanyCode'=> '1','intInsuranceKindCode'=>'1','lngTcf'=>'3070858641','strPolicyNo'=>'1055385883','dtExpiryDate'=>'2016-04-30T00:00:00','dtStartDate'=>'2015-03-31T00:00:00','strChassisNo'=>'6T1BE42RG465465','strRemarks'=>'demo','strUserCreated'=>'demo');
$response = $service->CreateVehicleInsurancePolicy($param)->CreateVehicleInsurancePolicyResult;
foreach ($response as $record) {
print_r($record);
print_r("<br>");
}
?>
【问题讨论】:
标签: php web-services soap web wsdl