PrepAway - Latest Free Exam Questions & Answers

What should you do?

You work as the Microsoft.NET developer at Domain.com. The Domain.com network consists of a single Active Directory domain named Domain.com. All servers in the domain run Windows Server 2003.
The development and deployment of client applications forms part of your responsibilities at Domain.com. You are busy developing a client application that will access a Microsoft.NET Remoting messenger application. The messenger application will allow messages to be sent between client applications. A remote class named RemoteMessenger exposes a remote event named MessageReceived. This event will be raised in the event of a client application calling the SendMessage method of the RemoteMessenger class.
A client event sink class named MessengerEventSink handles the remote MessageReceived event in an event handler named OnMessageReceived. In the OnMessage Received handler, the MessengerEventSink class raises its own MessageReceived event.
You are required to allow the client application to be notified as well as log messages when messages are sent through the messenger application. You should take care to not modify the RemoteMessenger class or the MessengerEventSink class.

What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
A delegate instance that represents the OnMessageReceived event handler to the MessageReceived event of the RemoteMessenger class should be attached.

B.
A delegate instance that represents the OnMessageReceived event handler to the MessageReceived event of the MessengerEventSink class should be attached.

C.
A delegate instance that represents a method in the client application to the MessageReceived event of the MessengerEventSink class should be attached.

D.
A delegate instance that represents a method in the client application to the MessageReceived event of the RemoteMessenger class should be attached.

Explanation:
The delegate instance that is attached to an event that gets raised in a remote class must also be called remotely. However, the direction of the remote call to raise events is from the remote server to the remote client. For this to happen, both the remote server and the remote client must know about the class that contains the method. This can be done by creating client event sink classes. In this case the client event sink class is the MessengerEventSink class. The only purpose of a client event sink class is to allow it to be marshaled from the server to the client to result in the event getting raised at the client. Due to the client event sink class handling the remote event by raising its own MessageReceived event you should handle the client event sink’s MessageReceived event. This will allow you to log messages when the event is raised. And by not coupling the MessengerEventSink class’ event handler to a specific implementation you will allow client applications to handle the remote event through client-specific implementations.
Incorrect answers:
A: When you attach a delegate instance that represents the OnMessageReceived event handler to the MessageReceived event of the RemoteMessenger class then the event handler will be coupled to a specific implementation and in addition you would then need to modify the MessengerEventSink class which will result in you not complying with the requirements.
B: When you attach a delegate instance that represents the OnMessageReceived event handler to the MessageReceived event of the MessengerEventSink class then the event handler will be coupled to a specific implementation and then it would also require you to modify the MessengerEventSink class which will result in you not complying with the requirements.
D: When you attach a delegate instance that represents a method in the client application to the MessageReceived event of the RemoteMessenger class the event that gets raised at the server and its invocation is not automatically marshaled to the client application. It is client event sink classes that allow you to marshal event invocations from a remote server to a remote client.

VB, Implementing Web Services Enhancements (WSE) 3.0 (6 Questions)


Leave a Reply