Ask a questionAsk a question
 

Proposed AnswerWS_CUSTOM_CHANNEL_BINDING

  • Wednesday, November 04, 2009 4:42 PMBob38 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
     Hello all

    I need your help to implement a way to overload the HTTP protocol by another one. As per to my understanding, I should use the structure
    WS_CHANNEL_BINDING which allows to define a custom channel using the parameter WS_CUSTOM_CHANNEL_BINDING.
    Unfortunately, there is not enough documentation on the web on this function. I only find in Windows Web Services Examples the project HttpCalculatorWithLayeredChannelClientExample that uses this mechanism.

    The summary of the project says: This example show how to use the service proxy to talk to an HTTP based calculator service using a custom channel. The custom channel is a layered channel which simply delegates all functionality to the existing HTTP channel.

    But it's really not clear when we read the code how it delegates all functionality to the existing HTTP channel.

    Can anyone help us to find out how we can use this principle.
    What are the basic steps ? and if there is another sample that use WS_CUSTOM_CHANNEL_BINDING, I would be very grateful.

    Thanks a lot

All Replies

  • Thursday, November 05, 2009 6:27 AMHao Xu [MSFT]ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Proposed Answer
    In a nutshell, the custom channel allows you to provide your own implementation (as a set of callbacks) of channel lifetime/state management (create/close/reset/free), sending and receiving messages using the channel. In the custom channel sample, you can see a new channel structure is created to wrap an HTTP channel object. All the callbacks are implemented by calling the corresponding functions on the HTTP channel. The new channel structure and the callbacks are hooked into the WWSAPI runtime through the three channel properties WS_CHANNEL_PROPERTY_CUSTOM_CHANNEL_CALLBACKS, WS_CHANNEL_PROPERTY_CUSTOM_CHANNEL_PARAMETERS, WS_CHANNEL_PROPERTY_CUSTOM_CHANNEL_INSTANCE.

    If this does not make sense to you, maybe you can share your requirement so that we can give more specific explanation.
    • Proposed As Answer byHao Xu - MSFT Tuesday, November 10, 2009 5:43 AM
    •