Home » Microsoft » 70-518 » What will you do?
You create a Windows application using .NET Framework 4.0. The application contains a set of WCF services to authorize and clear up credit card transactions. A separate service is implemented for each credit card provider. However, the same service contracts and data contracts are used across all implementations. The incoming requests to the service must conform to the contracts.
You want to implement a validation strategy to meet the requirements by using the least amount of development efforts.
What will you do?
A. Use a message inspector.
B. Implement IDispatchMessageInspector interface.
C. Implement a custom class that inherits from SoapExtensionAttribute.
D. Use the CustomValidator class.
Correct Answer: B
Explanation/Reference:
Explanation others:
In the given scenario, you will use the IDispatchMessageInspector interface. The IDispatchMessageInspector interface is used to define the methods that permit custom inspection or modification of inbound and outbound application messages in service applications. There are a large number of situations that require intercepting messages before invoking the operation for which it is designed. Typically, message inspectors are inserted by a service behavior, an endpoint behavior, or a contract behavior. The behavior then adds the message inspector to the DispatchRuntime.MessageInspectors collection.
Note: IDispatchMessageInspector objects are always invoked at the identical point.
Note: despite its name, implementing this interface allows us to both inspect and modify inbound and outbound messages.