Below is a simple example using PHP to login to the content service and display the list of makes. Be sure to use soap.wsdl_cache_enabled
to cache the WSDL as it is very large.
Code Block |
---|
<?php |
...
function getSessionId(){ |
...
$soapclient_options = array(); |
...
//$soapclient_options['proxy_host'] = "127.0.0.1"; |
...
//$soapclient_options['proxy_port'] = "8888"; |
...
$loginService = new SoapClient("http://contentservices.installernet.com/vtt/2.0/unencrypted/vttechnician20_unen.dll/SOAP?service=vtUserServices", $soapclient_options); |
...
// Build Login Request $params = new stdClass; $request = new stdClass; $request->ApplicationID = "79483C46-2637-45F1-9209-573DDF985BFC"; |
...
$request->Username = "{username}"; |
...
$request->Password = "{password}"; |
...
$request->IPAddress = "{end user IP Address}"; |
...
$request->ApplicationVersion = ""; |
...
$request->HTTPReferrer = ""; |
...
$params->LoginRequest = $request; |
...
// |
...
Login $response = $loginService->Login23($params); |
...
if (!$response->Result) |
...
{ throw new Exception('Unable to login .'); |
...
} return $response->LoginResult->SessionId; |
...
} function getMakes($_sessionId){ |
...
$soapclient_options = array(); |
...
$vehicleService = new SoapClient("http://contentservices.installernet.com/vtt/2.0/unencrypted/vttechnician20_unen.dll/SOAP?service=vtVehicleServices", $soapclient_options); |
...
// Build Request $params = new stdClass; $params->SessionId = $_sessionId; $params->RetailerId = {retailerid}; // Get Makes $response = $vehicleService->GetRetailerVehicleMakesDown($params); |
...
return $response->MakeList->vtVehicleMake; |
...
} |
...
try |
...
{ $sessionId = getSessionId(); |
...
$makes = getMakes($sessionId); |
...
foreach ($makes as $value) { $make = $value->Make; echo "Value: $make\n"; |
...
} } catch (SoapFault $exception) { echo $exception->getMessage(); |
...
} |
...
?> |