You work as the Microsoft.NET developer at Domain.com. Domain.com operates as an agency that specializes in the placement of various breeds of pedigreed animals, servicing at least ten different countries on two continents. 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 Extensible Markup Language (XML) Web Services forms part of your responsibilities at Domain.com. You are currently developing an Extensible Markup Language (XML) Web Service that will return biological images in SOAP messages. Due to the size of these messages, you decided to create a class named CompressionSoapExtension to compress the SOAP responses. You thus need to implement the ProcessMessage method to encrypt the SOAP responses.
What should you do?
A.
Encrypt the message if the Stage property of the Soapmessage parameter is set to SoapMessageStage.BeforeDeserialize.
B.
Encrypt the message if the Stage property of the Soapmessage parameter is set to SoapMessageStage.BeforeSerialize.
C.
Encrypt the message if the Stage property of the Soapmessage parameter is set to SoapMessageStage.AfterDeserialize.
D.
Encrypt the message if the Stage property of the Soapmessage parameter is set to SoapMessageStage.AfterSerialize.
Explanation:
You should compress the message if the Stage property of the SoapMessage instance is set to SOapMessageStage.AfterSerialize. The Stage property represents the stage in serialization and deserialization process of a SOAP message. At this stage, the Web method has been invoked and the output parameter and return value have been fully serialized into an XML message. This will allow you to compress the message before it is sent back to the Web service client.
Incorrect answers:
A: If you set the Stage property of the SoapMessageStage.BeforeDeserialize, then the input parameters to a Web method would not be deserialized into input parameters.
B: If you set the Stage property of the SoapMessageStage.BeforeSerialize, then the Web method will be invoked, but the output parameters and return value will not have been serialized into an XML message.
C: If you set the Stage property of the SoapMessageStage.AfterDeserialize, then the input parameters to the Web method will be serialized into input parameters, but the Web method would not yet have been invoked.