Which code segment should you use?

You create a service-oriented architecture (SOA) application that will be deployed on a Windows HPC Server 2008 cluster. The application contains the following code segment.
(Line numbers are included for reference only.)

01 ServiceContract]
02 public interface IWcfService
03 {
04 [OperationContract]
05 [FaultContract(typeof(ArgumentNullException))] 06 void CreatePerson(Person p);
07 }
09 public class WcfService : IWcfService
10 {
11 public void CreatePerson(Person p)
12 {
13 if (p == null)
14 throw new ArgumentNullException();
15 …
16 }
17 }

You need to ensure that the client application properly handles the ArgumentNullException exception. Which code segment should you use?

You create a service-oriented architecture (SOA) application that will be deployed on a Windows HPC Server 2008 cluster. The application contains the following code segment.
(Line numbers are included for reference only.)

01 ServiceContract]
02 public interface IWcfService
03 {
04 [OperationContract]
05 [FaultContract(typeof(ArgumentNullException))] 06 void CreatePerson(Person p);
07 }
09 public class WcfService : IWcfService
10 {
11 public void CreatePerson(Person p)
12 {
13 if (p == null)
14 throw new ArgumentNullException();
15 …
16 }
17 }

You need to ensure that the client application properly handles the ArgumentNullException exception. Which code segment should you use?

A.
catch (SoapException ex)
{

}

B.
catch (FaultException ex)
{

}

C.
catch (ArgumentNullException ex)
{

}

D.
catch (FaultException<ArgumentNullException> ex)
{

}



Leave a Reply 0

Your email address will not be published. Required fields are marked *