locked
DefaultHandler for HttpGet with ServiceState-Attribute RRS feed

  • Question

  • Step 3 of Servicetutorial 6 states that there are default Get- and HttpGet- Handlers, that are active if no other Handlers are present. I tried to delete the Handlers and add a [ServiceState] to the _state field but I dont know where to put the line
     [EmbeddedResource("RoboticsServiceTutorial6.ServiceTutorial6.xslt")]

    The Compiler doesn't find the Attribute [ServiceState] (maybe wrong namespace?) . Am I missing something here?

    Here is the part of the tutorial Im talking about:

    There is also an easier way to attach the embedded XSLT resource to the state in cases where you want to use the default Get and HttpGet handlers. In this case, instead of defining a null transform field and using the [EmbeddedResource] attribute you can do the following:

    • Remove the _transform field and the EmbeddedResource attribute on top of it.
    • Annotate the state field with the [ServiceState] attribute providing the embedded XSLT file to use:
    C#
     [EmbeddedResource("RoboticsServiceTutorial6.ServiceTutorial6.xslt")]
    string _transform = null;
    • Remove the Get and HttpGet handlers.

    This will tell the base class to implicitly handle the Get and HttpGet messages using the default handlers for both, using the specified XSL Transformation for HttpGet responses. Note that the Get and HttpGet operations should already be in the service's operations port for them to be handled implicitly.


    Saturday, October 27, 2007 2:20 PM

Answers

  • Ah, this is a piece of documentation from our next version that has slipped in. For 1.5 you need an explicit get handler to add the stylesheet. That's why the compilation doesn't work Smile

     

    If you add back your get handlers and set the style sheet as you did before then it will work.

     

    Sorry about that.

     

    Henrik

    Saturday, October 27, 2007 8:40 PM