Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $wsdl = "http://cnx.test.dat.com:9280/wsdl/TfmiFreightMatching.wsdl";
- $client = new SoapClient($wsdl, array('trace' => true));
- $params = array('loginOperation'=>array('loginId'=>'ryder_cnx1','password'=>'ryder1','thirdPartyId'=>'dl'));
- $client->Login($params);
- $data = $client->__getLastResponse();
- $p = xml_parser_create();
- xml_parse_into_struct($p, $data, $vals, $index);
- xml_parser_free($p);
- $token = [];
- foreach ($vals as $key => $value) {
- foreach ($value as $key1 => $value1) {
- if($key1 == "value")
- $token[] = $value1;
- }
- }
- echo "Primary Token = ".$token[0];
- echo "<br> Secondary Token = ".$token[1];
- //echo "<br> Expiry Date = ".$token[2];
- $params_session = array("sessionToken"=> array("primary"=>$token[0], "secondary"=>$token[1]));
- $namespace = 'http://www.tcore.com/TcoreTypes.xsd'; // I am not sure about this namespace. Whether its correct or not.
- $header = new SoapHeader($namespace,'sessionHeader',$params_session,true);
- $client->__setSoapHeaders($header);
- $params_data = array('lookupRateOperations'=> array(
- 'equipment'=>'Vans',
- 'origin'=>array('postalCode'=>array('country'=>'US','code'=>'30004')),
- 'destination'=>array('postalCode'=>array('country'=>'US','code'=>'10001'))
- ));
- try{
- $result = $client->LookupRate($params_data);
- print_r($result);
- }catch (SoapFault $exception){
- //or any other handling you like
- print_r(get_class($exception));
- enter code hereprint_r($exception);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement