locked
How to Mimic HttpPost Commands RRS feed

  • Question

  • I would like to use something like wget to send HttpPost commands to MRDS services.  I know this used to be possible because it is documented in the text-to-speech technology sample.  It says you can go to a URL like this to make the service speak:

    http://localhost:50000/texttospeech?Say=Hello

     

    I dug through the service a little and I think some things have changed since that documentation page was written.  Now, I think the syntax would be something like this:

    http://localhost:50000/texttospeech?SpeechText=Hello&SpeechTextSubmit=Say

     

    But I still can’t make it work.  Is this still possible in MRDS 2.0?  Can someone post a pointer to a working example?

    Thanks,

    -Ben


    www.coroware.com
    Wednesday, March 4, 2009 4:58 AM

Answers

  • Ah yes, that's why it's called a Query String :-)

    I'm assuming you created a handler for HttpQuery and it is now working?

    Trevor
    Saturday, March 7, 2009 6:33 AM

All replies

  • Hi Ben,

    You have uncovered a "feature" of the 2.0 Text To Speech service. It was rewritten to use the default HttpGet behavior that is new in 2.0. This will automatically display a form (using an XSLT) that allows you to enter text interactively. See the following code:

    // Note that the transform is declared here on the State  
    [ServiceState(StateTransform = "Microsoft.Robotics.Technologies.Speech.TextToSpeech.TextToSpeech.xslt")]  
    [InitialStatePartner(Optional = trueServiceUri = ServicePaths.Store + "/TextToSpeech.config.xml")]  
    TextToSpeechState _state = new TextToSpeechState();  
     

    When you issue a URL like texttospeech?SpeechText=xxx you are implicitly using the HttpGet operation, not HttpPost. (You can confirm this by setting a break in the HttpPost handler and you will see that it is not called).

    If you can issue a HTTP POST request from your program then you should be able to make this work, but you can't do it by appending a Query String to the URL.


    Trevor
    Wednesday, March 4, 2009 6:47 AM
  • Hi Trevor,

    Thanks for the fast reply.  I am aware of default HttpGet handlers, and that was not it.  Even in 'old school' services that define a HttpGet handler and an embedded resource string, I was not hitting my breakpoint in the HttpGet hander when i would issue a URL like texttospeech?SpeechText=xxx. 

    I realized that when i issue a URL like texttospeech?SpeechText=xxx, i am doing a HttpQuery.  So that clears everything up for me.

    Thanks,
    -Ben

    www.coroware.com
    Wednesday, March 4, 2009 3:48 PM
  • Ah yes, that's why it's called a Query String :-)

    I'm assuming you created a handler for HttpQuery and it is now working?

    Trevor
    Saturday, March 7, 2009 6:33 AM
  • Yup, I got it all working now.
    Thanks,
    -Ben

    www.coroware.com
    Monday, March 9, 2009 2:03 PM