Some web API functions will inexplicably fail when called from a standard PHP SOAP client. Here's a workaround: A function that calls a web API method via GET. Please note that this may not be sufficiently secure for sending sensitive information such as passwords, and I haven't tested it thoroughly on a wide variety of API methods, so use it at your own risk ;-)
protected function callTessituraViaGet($functionName,$parameters) { // If you store the Tessitura WSDL location in a separate configuration file, // you may need to strip the query from the full WSDL URL. $tessituraURLComponents = explode('?',TESSITURA_WSDL_LOCATION); $URLToTessituraASPX = $tessituraURLComponents[0]; // Build the GET query string for the Tessitura call $queryString = "/$functionName?"; foreach($parameters as $key => $value) $queryString .= urlencode($key) . '=' . urlencode($value) . '&'; // Replace die() with your own function to handle connection failure $handle = fopen($URLToTessituraASPX . $queryString, 'r') or die("Can't connect to Tessitura."); $response = ''; while(!feof($handle)) $response .= fgets($handle); // Convert response to SimpleXMLElement $response = new SimpleXMLElement($response); $response = $response->children('urn:schemas-microsoft-com:xml-diffgram-v1'); $response = $response->children(''); $response = $response->children(); return $response; }
And here's an example of this function in use:
$performances = $this->callTessituraViaGet('GetPerformancesEx3', array( 'sWebSessionId' => $_SESSION['tessSessionKey'], 'sStartDate' => date('n-j-Y',$this->startTimestamp), 'sEndDate' => date('n-j-Y',$this->endTimestamp), 'iVenueID' => -1, 'iModeOfSale' => 6, 'iBusinessUnit' => 1, 'sSortString' => '', 'sKeywords' => '', 'cKeywordAndOrStatement' => '', 'sArtistLastName' => '', 'sFullText' => '', 'sFullTextType' => '', 'sContentType' => '', 'sPerformanceIds' => '', 'sSeasonIds' => '' ));