This is what I am trying to create (created via WSDL by soapUI 1.7.1):
Code: Select all
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices.traffic.com/schemas/v3_2/WebServiceClientContext" xmlns:com="http://webservices.traffic.com/schemas/v3_2/Commute">
<soapenv:Header>
<web:WebServiceClientContextElement>
<web:ticket>big long authentication token</web:ticket>
</web:WebServiceClientContextElement>
</soapenv:Header>
<soapenv:Body>
<com:GetKeyRoutesPairsByMetroRequest>
<com:metroId>18</com:metroId>
<com:tags>WebsiteV2</com:tags>
</com:GetKeyRoutesPairsByMetroRequest>
</soapenv:Body>
</soapenv:Envelope>Code: Select all
<?php
// this is the authentication ticket I got from an authentication webservice
$ticket = "big long authentication token";
// array of values to be passed to method
$param = array(
'metroId' => '18',
'tags' => 'WebsiteV2'
);
try {
// instantiate soapclient
$client = new SoapClient("http://webservices.traffic.com/services/v3_2/Commute?wsdl");
// create header object and insert into headers
$auth = array('ticket'=>$ticket);
$authvar = new SoapVar($auth, SOAP_ENC_OBJECT);
$header = new SoapHeader("http://webservices.traffic.com/schemas/v3_2/WebServiceClientContext",
"WebServiceClientContextElement", $authvar, false);
$client->__setSoapHeaders(array($header));
// do it
print_r($response = $client->getKeyRoutesByMetro($param));
}
catch (SoapFault $exception) {
echo $exception . "<br><br>";
}
?>Code: Select all
SoapFault exception: [soapenv:Server.userException] (null) in /home/zkent/public_html/communities/Traffic/common/development/roadwayWS/getKeyroutesByMetro.php:24
Stack trace:
#0 [internal function]: SoapClient->__call('getKeyRoutesByM...', Array)
#1 /home/zkent/public_html/communities/Traffic/common/development/roadwayWS/getKeyroutesByMetro.php(24): SoapClient->getKeyRoutesByMetro(Array)
#2 {main}