resle February 2016

Determining assembly name for use with PHP DOTNET

I am trying to use Microsoft's Speech Platform 11 through PHP's DOTNET object https://msdn.microsoft.com/en-us/library/jj127858.aspx

The platform should be instantiated as follows

$platform = new DOTNET("assembly-name", "Microsoft.Speech.Recognition");

But how to retrieve the assembly name for Speech Platform 11? (to replace "assembly-name" in the initialization call)

I have tried several assembly names by... guesswork, obviously with no luck. The initialization error being thrown

Failed to instantiate .Net object [CreateInstance] [0x80070002] The system cannot find the file specified

UPDATE

With the following code, I was able to get PHP to find and use the assembly

$full_assembly_string = 'Microsoft.Speech, Version=11.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35';
$full_class_name = 'Microsoft.Speech.Recognition.SpeechRecognitionEngine';

$interface = new DOTNET($full_assembly_string, $full_class_name);

However, there's a new roadblock:

Failed to instantiate .Net object [Unwrapped, QI for IDispatch] [0x80004002] No such interface supported

At first glance it seems it has to do with COM visibility. But if for any reason the class isn't visible to COM (and it seems odd), how to change this? Is it even possible?

Answers


Jens A. Koch February 2016

Not tested. Just another guess.

According to the Microsoft Speech Platform SDK 11 Docs:

https://msdn.microsoft.com/en-us/library/microsoft.speech.recognition.speechrecognitionengine.aspx

i would give this a try:

  • "assembly" Microsoft.Speech
  • "classname" Microsoft.Speech.Recognition.SpeechRecognitionEngine
  • Microsoft.Speech.Recognition is only the namespace

    $sre = new DOTNET(
        'Microsoft.Speech',
        'Microsoft.Speech.Recognition.SpeechRecognitionEngine'
    );
    

Methods are documented here: https://msdn.microsoft.com/en-us/library/microsoft.speech.recognition.speechrecognitionengine_members(v=office.14).aspx#Anchor_2

Post Status

Asked in February 2016
Viewed 3,945 times
Voted 6
Answered 1 times

Search




Leave an answer