What should you do?
You call a method in a Web service.
The following exception is thrown in the Web service client.
System.Web.Services.Protocols.SoapException: Server was unable toprocess request. –> System.NullReferenceException: Object reference not set to an instance of an object.
You discover that it is the following line of code that throws the exception.
if (Session [“StoredValue”] == null)
You need to ensure that the method runs without throwing the exception. What should you do?
What should you do?
You create a Web service.
The method in the Web service maintains session information between calls.
When a client invokes the method, the following exception is thrown :
System.Web.Services.Protocols.SoapException: Server was unable toprocess request. —> System.NullReferenceException: Object reference not set to an instance of an object.
You need to ensure that the Web service method can be called without generating an exception.
What should you do?
What should you do?
You create a Web service that will be deployed to a production Web server.
You need to ensure that the first Web service request returns a response in the shortest amount of time possible.
What should you do?
What should you do?
You create a Web service.
The Web service must be deployed on a remote Web server.
You need to ensure that the deployment does not place the source code for the Web service on the Web server.
What should you do?
What should you do?
A Web service exposes a method named GetChart that returns an image.
The data used to generate the image changes in one-minute intervals.
You need to minimize the average time per request for CPU processing.
What should you do?
What should you do?
When you execute a client application, the following exception is
thrown.
EncryptedKeyToken is expected but not present in the security header of the incoming message.
You discover that the exception is thrown when the client application invokes a Web service named Math with the following code.
(Line numbers are included for reference only.)
01 try
02 {
03 MathWse ws = new MathWse ();
04 int result = ws.Add(1, 2);
05 }
06 catch (Exception ex)
07 {
08 MessageBox.Show(ex.Message);
09 }
The client application and Web service have the same Web Services Enhancements (WSE) 3.0 policy.
The policy configuration file contains the following policy section.
<policy name=”Secure”>
<anonymousForCertificateSecurity establishSecurityContext=”false” renewExpiredSecurityContext=”true” requireSignatureConfirmation=”false” messageProtectionOrder=”SignBeforeEncrypt” requireDerivedKeys=”true” ttlInSeconds=”300″>
<!– XML defining the serviceToken and protection –>
</anonymousForCertificateSecurity>
</policy>
You need to ensure that the client application can communicate with the Web service.
What should you do?
What should you do?
A message queue named SecureQueue requires incoming messages to be authenticated.
When an application attempts to send a message to SecureQueue, the following exception is thrown.
User’s internal Message Queuing certificate does not exist.The following code is used to send the message.
(Line numbers are included for reference only.)
01 MessageQueue mq = new MessageQueue(“.\\SecureQueue”);
02 Message m = new Message(“Test Message”);
03 m.UseAuthentication = true;
04 mq.Send(m);
You need to ensure that a message can be sent to SecureQueue without the exception being thrown.
What should you do?
What should you do?
A file named Util.asmx contains the following code segment.
(Line numbers are included for reference only.)
01 <%@ WebService Language=”C#” class=”Exam.Util” %>
02 namespace Exam {
03 public class Util {
04 public string GetData() {
05 return “data”;
06 }
07 }
08 }
You need to expose the GetData method through a Web service.
What should you do?
What should you do?
You are writing an application that calls a Web service.
The application must call the Web service asynchronously and also perform a small amount of processing while the Web service is running.
The return value from the Web service is required for additional processing.
You need to ensure that the application can call the Web service asynchronously and also process the return value.
Your solution must keep processor cycles to a minimum.
What should you do?
What should you do?
An application fails when executing a specific operation.
You discover that the failure occurs when an exception is raised by a Web service.
The application uses the following code to call the Web service.
void Process()
{
ProcessService serviceProxy = new ProcessService();
serviceProxy.ProcessDataCompleted += new ProcessDataCompletedEventHandler(ServiceCompleted);
serviceProxy.ProcessDataAsync(data);
}
You need to ensure that the application does not fail when the Web service raises the exception.
Your solution must maximize the performance of your code.
What should you do?