jeudi 16 avril 2015

Response from soap header

Even though i am very new to php soap concept, i write a program to communicate a web server using SoapClient.


This is my wsdl link: http://ift.tt/1GiCa8a


Service name : CreateVehicleInsurancePolicy Link : http://ift.tt/1CzNEla


I hosted my program in in an ssl certified hosting.When it run it generating a response in soap body response(lngSerial).I wanted to print the response value from soap header (SoapHeaderOut).


that is intResponseCode,strArMsg,strEnMsg.


Please guide me.Below i am providing the script which i am using.



<?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("http://ift.tt/1GiCa8a");
$auth = new SOAPStruct('username','password');
$header = new SoapHeader("http://ift.tt/1CzNEle","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>");
}

?>




Aucun commentaire:

Enregistrer un commentaire