4.3 Dispatching a Call on the Server Using Deactivate

This example assumes that the client already has an interface pointer to an instance of an object that implements IRemoteDispatch. The following diagram helps to illustrate this example. The scenario is around a remote server object which has a method named Method. This method takes two string parameters. The first parameter a is an in only parameter, the second parameter b is the out only parameter.

 Method(string a, out string b);

The call graph for this on the client side is given below.

Call sequence for dispatching a call with Deactivate from client to server

Figure 5: Call sequence for dispatching a call with Deactivate from client to server

Call graph on the client side for the given scenario

Figure 6: Call graph on the client side for the given scenario

  1. The client accepts a call for "Method" taking two parameters a and b.

  2. The client transforms the method call into a byte representation as specified in [MS-NRTP] section 3.1.5.1.1.

  3. The client then takes the byte representation and passes it as a BSTR in the s parameter over RemoteDispatchAutoDone.

    The representative BSTR for the current example would look like the following.

     00000000 00000000 00000100 00000000  ................      
     00121500 06120000 6874654d 5112646f  ........Method.Q      
     74736554 706d6f43 6574202c 202c7473  TestComp, test,       
     73726556 3d6e6f69 2e302e30 2c302e30  Version=0.0.0.0,      
     6c754320 65727574 75656e3d 6c617274   Culture=neutral      
     7550202c 63696c62 5479654b 6e656b6f  , PublicKeyToken      
     3030313d 66663066 65643064 34336662  =100f0ffd0debf34      
     00000233 48051200 6f6c6c65 00000b11  3......Hello....      
     00650073 00000073 78adbf68 00000642  s.e.s...h..xB...      
     61df552e 800000d1 0000017e 00000006  .U.a....~.......      
     00000000 00001771 00000002 76726553  ....q.......Serv      
     20656369 6b636150 202c3120 36322e76  ice Pack 1, v.26      
     00000037 00000002 0000004c 00000009  7.......L.......      
     00000002 00000059 00000013 00000004  ....Y...........      
     0000005d 00000015 00000002 0000006a  ]...........j...      
     0000001f 00000004 0000006e 00000021  ........n...!...      
    
  4. The server receives the call and transforms the incoming BSTR in parameter s into a method call. The server then dispatches the method call on the object.

    Call graph on the server side for the given scenario.

    Figure 7: Call graph on the server side for the given scenario.

  5. "Method" completes. On completion, it populates "World" into the out parameter b.

    Return call graph on the server side for the given scenario.

    Figure 8: Return call graph on the server side for the given scenario.

  6. The server now takes the return call and packages it again into a byte representation as specified in [MS-NRTP] section 3.1.5.1.1.

    RemoteDispatchAutoDone implementation takes the binary representation and makes it a payload for BSTR out parameter pRetVal.

    The representative BSTR for the current example would look like the following.

     00000000 00000000 00000100 00000000  ................
     04121600 00020000 12110000 726f5705  .............Wor
     000b646c 00000000 0020f490 00000000  ld........ .....
     61df71bf 800000d1 0000003a 00000000  .q.a....:.......
     00000000 00000000 ff6c5db0           .........]l.
    
  7. RemoteDispatchAutoDone implementation deactivates the server object by releasing all references to it such that the particular instance of the server is destroyed.

  8. As the client call returns the data received on the client side in the pRetVal BSTR parameter is converted back to a return call parameters and the control is transferred back to the caller.

    Return call graph on the client side for the given scenario.

    Figure 9: Return call graph on the client side for the given scenario.

Show: