MB7-701 - Microsoft Dynamics NAV 2013 Core Setup and Finance

Go back to Microsoft

Example Questions

You are developing a Windows Communication Foundation (WCF) REST service to provide access to a library book catalog. The following code segment defines the service contract. (Line numbers are included for reference only.) 01 [ServiceContract()] 02 [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] 03 public Class LibraryService 04 { 05 public Book GetBookByTitle(string title) 06 { 07 ... 08 } 09 10 [WebGet(UriTemplate = "Book/{id}")] 11 public Book GetBookById(string id) 12 { 13 ... 14 } 15 } Library patrons want the ability to search the catalog by title. You need to ensure that the GetBookByTitle method is exposed as a service method. Which code segment should you insert at line 04? A service implements the following contract. (Line numbers are included for reference only) 01 [ServiceContract(SessionMode = SessionMode.Required)] 02 public interface IContosoService 03 { 04 [OperationContract(IsOneWay = true, IsInitiating = true)] 05 void OperationOne(string value); 06 07 [OperationContract(IsOneWay = true, IsInitiating = false)] 08 void OperationTwo(string value); 09 } The service is implemented as follows: 10 class ContosoService: IContosoService 11 { 12 public void OperationOne(string value) {...} 13 ... 14 public void OperationTwo(string value) {...} 15 } ContosoService uses NetMsmqBinding to listen for messages. The queue was set up to use transactions for adding and removing messages. You need to ensure that OperationOne and OperationTwo execute under the same transaction context when they are invoked in the same session. What should you do? Windows Communication Foundation (WCF) service is self-hosted in a console application. The service implements the lTimeService service interface in the TimeService class. You need to configure the service endpoint for HTTP communication. How should you define the service and endpoint tags? A Windows Communication Foundation (WCF) service implements the following contract. [ServiceContract] public interface IHelloService { [OperationContract(WebGet(UriTemplate="hello?name={name}"))] string SayHello(string name); } The implementation is as follows: public class HelloService: IHelloService { public string SayHello(string name) { return "Hello " + name; } } The service is self-hosted, and the hosting code is as follows: WebServiceHost svcHost = CreateHost(); svcHost.Open(); Console.ReadLine(); svcHost.Close(); You need to implement CreateHost so that the service has a single endpoint hosted at http://localhost:8000/HelloService. Which code segment should you use? A Windows Communication Foundation (WCF) service is generating a separate namespace declaration for each body member of a message contract, even though all body members share the same namespace. You need to simplify the XML representation of your message contract so that the namespace is only declared once. What should you do? You are creating a Windows Communication Foundation (WCF) service that uses claims-based authorization. The following code retrieves the correct claim set. var claims = ServiceSecurityContext.Current.AuthorizationContext.ClaimSets[0]; You need to validate that the requesting client application has included a valid DNS value in the claim. Which code segment should you use to retrieve the claim for validation? You are developing a Windows Communication Foundation (WCF) service. The service configuration file has a <System.Diagnostics> element defined. You need to ensure that all security audit information, trace logging, and message logging failures are recorded. Which configuration segment should you add to the <System.Diagnostics> element? Four Windows Communication Foundation (WCF) services are hosted in Microsoft Internet Information Services (IIS). No behavior configuration exists in the web.config fiIe. You need to configure the application so that every service and endpoint limits the number of concurrent calls to 50 and the number of concurrent sessions to 25. Which XML segment should you add to the system.serviceModel configuration section of the web.config file? You are developing a data contract for a Windows Communication Foundation (WCF) service. The data in the data contract must participate in round trips. Strict schema validity is not required. You need to ensure that the contract is forward-compatible and allows new data members to be added to it. Which interface should you implement in the data contract class? You are moving a Windows Communication Foundation (WCF) service into production. You need to be able to monitor the health of the service. You only want to enable all performance counter instances exposed by the ServiceModelService counter group. Which element should you add to the system.serviceModel section in the application configuration file? A Windows Communication Foundation (WCF) service listens for messages at net.tcp://www.contoso.com/MyService. It has a logical address at http://www.contoso.com/MyService. The configuration for the WCF client is as follows: <endpoint address="http://www.contoso.com/MyService" binding="netTcpBinding" bindingConfiguraton="NetTcpBinding_IMyService" contract="ServiceReference1.IMyService" name="NetTcpBinding_IMyService"/> The generated configuration does not provide enough information for the client to communicate with the server. You need to update the client so that it can communicate with the server. What should you do? A Windows Communication Foundation (WCF) client application is consuming an RSS syndication feed from a blog. You have a SyndicationFeed variable named feed. The application iterates through the items as follows. (Line numbers are included for reference only.) 01 foreach (SyndicationItem item in feed.Items) 02 { 03 } You need to display the content type and body of every syndication item to the console. Which two lines of code should ou insert between lines 02 and 03? You are creating a Windows Communication Foundation (WCF) service that is implemented as follows. (Line numbers are included for reference only.) 01 [ServiceContract] 02 [ServiceBehavior(IncludeExceptionDetailsInFaults = true)] 03 public class OrderService 04 { 05 [OperationContract] 06 public void SubmitOrder(Order anOrder) 07 { 08 try 09 { 10 ... 11 } 12 catch(DivideByZeroException ex) 13 { 14 ... 15 } 16 } 17 } You need to ensure that the stack trace details of the exception are not included in the error information sent to the client. What should you do? You are creating a Windows Communication Foundation (WCF) service to process orders. The data contract for the order is defined as follows: [DataContract] public class Order { [DataMember] public string CardHolderName { get; set; } [DataMember] public string CreditCardNumber { get; set; } } You have the following requirements: Enable the transmission of the contents of Order from the clients to the service. Ensure that the contents of CreditCardNumber are not sent across the network in clear text. Ensure that the contents of CreditCardNumber are accessible by the service to process the order. You need to implement the service to meet these requirements. What should you do? You are developing a Windows Service. The Windows Service will host a Windows Communication Foundation (WCF) service. The Windows Service class will inherit from ServiceBase. You need to ensure that the WCF service starts when the Windows Service is restarted. What should you do in the Windows Service class? A Windows Communication Foundation (WCF) service that handles corporate accounting must be changed to comply with government regulations of auditing and accountability. You need to configure the WCF service to execute under the Windows logged-on identity of the calling application. What should you do? You have an existing Windows Communication Foundation (WCF) service that exposes a service contract over HTTP. You need to expose that contract over HTTP and TCP. What should you do? You are developing a Windows Communication Foundation (WCF) service that allows customers to update financial data. The service contract is defined as follows. (Line numbers are included for reference only) 01 [ServiceContract] 02 public interface IDataUpdate 03 { 04 [OperationContract] 05 [TransactionFlow(TransactionFlowOption.Mandatory)] 06 void Update(string accountNumber, double amount); 07 } 08 09 class UpdateService : IDataUpdate 10 { 11 [OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = false)] 12 public void Update(string accountNumber, double amount) 13 { 14 ... 15 } 16 } 17 You need to ensure that the service is invoked within the transaction. What should you do? A WCF service code is implemented as follows. (Line numbers are included for reference only) 01 [ServiceContract] 02 [ServiceBehavior(InstanceContextMode = 03 InstanceContextMode.Single)] 04 public class CalculatorService 05 { 06 [OperationContract] 07 public double Calculate(double op1, string op, double op2) 08 { 09 } 10 } You need to increase the rate by which clients get the required response from the service. What are two possble ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.) You are creating a Windows Communication Foundation (WCF) service. You need to ensure that the service is compatible with ASP.NET to make use of the session state. Which binding should you use? A Windows Communication Foundation (WCF) service is responsible for transmitting XML documents between systems. The service has the following requirements: It must minimize the transmission size by attaching the XML document as is without using escape characters or base64 encoding. It must interoperate with systems that use SOAP but are not built on the .NET plafform. You need to configure the service to support these requirements. Which message encoding should you use? A Windows Communication Foundation (WCF) solution uses the following contract: [ServiceContract(SessionMode=SessionMode.Allowed)] public interface IMyService { [OperationContract(IsTerminating=false)] void Initialize(); [OperationContract(IsInitiating=false)] void DoSomething(); [OperationContract(IsTerminating=true)] void Terminate(); } You need to change this interface so that: lnitialize is allowed to be called at any time before Terminate is called. DoSomething is allowed to be called only after Initialize is called, and not allowed to be called after Terminate is called. Terminate will be allowed to be called only after Initalize is called. Which two actions should you perform? (Each correct answer presents part of the sdution. Choose two) You are developing a Windows Communication Foundation (WCF) service. You establish that the largest size of valid messages is 8,000 bytes. You notice that many malformed messages are being transmitted. Detailed information about whether each message is malformed must be logged. You need to ensure that this information is saved in XML format so that it can be easily analyzed. What should you add to the service configuration file? You develop a Windows Communication Foundation (WCF) service that interacts with Microsoft Message Queuing (MSMQ). The service requires sessions. You need to create a custom binding that enables messages sent to the queue to be viewed when you are using a listener tool. Which binding elements should you use? A Windows Communication Foundation (WCF) application uses a data contract that has several data members. You need the application to throw a SerializationException if any of the data members are not present when a serialized instance of the data contract is deserialized. What should you do? You are adding a Windows Communication Foundation (WCF) service to an existing application. The application is configured as follows. (Line numbers are included for reference only) 01 <configuration> 02 <system.serviceModel> 03 <services> 04 <service name="Contoso.Sales.Stock.Service" 05 behaviorConfiguration="MetadataBehavior"> 06 <host> 07 <baseAddresses> 08 <add baseAddress="http://contosso.com:8080/StockService" /> 09 </baseAddresses> 10 </host> 11 </service> 12 </services> 13 <behaviors> 14 <serviceBehaviors> 15 <behavior name="MetadataBehavior"> 16 </behavior> 17 </serviceBehaviors> 18 </behaviors> 19 ... You need to configure the service to publish the service metadata. Which two actions should you perform? (Each answer presents part of the solution. Choose two.) A Windows Communication Foundation (WCF) solution uses the following contracts. (Line numbers are included for reference only.) 01 [ServiceContract(CallbackContract=typeof(INameService))] 02 public interface IGreetingService 03 { 04 [OperationContract] 05 string GetMessage(); 06 } 07 08 [ServiceContract] 09 public interface INameService 10 { 11 [OperationContract] 12 string GetName(); 13 } When the client calls GetMessage on the service interface, the service calls GetName on the client callback. In the client, the class NameService implements the callback contract. The client channel is created as follows: 22 InstanceContext callbackContext = new InstanceContext(new NameService("client")); 23 ... 24 ... 25 DuplexChannelFactory<IGreetingService> factory = new DuplexChannelFactory<IGreetingService>(typeof(NameService), binding, address); 26 IGreetingService greetingService = factory.CreateChannel(); You need to ensure that the service callback is processed by the instance of NameService. What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.) A class named TestService implements the following interface: [ServiceContract] public interface ITestService { [OperationContract] DateTime GetServiceTime(); } TestService is hosted in an ASP.NET application. You need to modify the application to allow the GetServiceTime method to return the data formatted as JSON. It must do this only when the request URL ends in /ServiceTime. What should you do? You are developing a Windows Communication Foundation (WCF) service. You enable logging in the configuration file. The opening tag is defined as follows. <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxMessagesToLog="20"> You need to ensure that logging is implemented so that only messages with SOAP headers are logged. What should you add to the filters element of the application configuration file? You are developing a Windows Communication Foundation (WCF) service that will be hosted in Microsoft Internet Information Services (IIS) 7.0. The service must be hosted in an lIS application named Info. You need to enable this service to be hosted in llS by changing the web.config file. Which XML segment should you add to the web.config file? You are consuming a Windows Communication Foundation (WCF) service in an ASP. NET Web application. The service interface is defined as follows: [ServiceContract] public interface ICatalog { [OperationContract] [WebGet(UriTemplate="/Catalog/Items/{id}", ResponseFormat=WebMessageFormat.Json)] string RetrieveItemDescription(int id); } The service is hosted at Catalogsvc. You need to call the service using jQuery to retrieve the description of an item as indicated by a variable named itemId. Which code segment should you use? You are creating a Windows Communication Foundation (WCF) service that implements operations in a RESTful manner. You need to add a delete operation. You implement the delete method as follows: void DeleteItems(string id); You need to configure WCF to call this method when the client calls the service with the HTTP DELETE operation. What should you do? You are creating a Windows Communication Foundation (WCF) service. You do not want to expose the internal implementation at the service layer. You need to expose the following class as a service named Arithmetic with an operation named Sum: public class Calculator { public int Add(int x, int y) { } } Which code segment should you use? You are modifying an existing Windows Communication Foundation (WCF) service that is defined as follows: [ServiceContract] public interface IMessageProcessor { [OperationContract] void ProcessMessages(); } public class MessageProcessor: IMessageProcessor { public void ProcessMessage(); SubmitOrder(); } SubmitOrder makes a call to another service. The ProcessMessage method does not perform as expected under a heavy load. You need to enable processing of multiple messages. New messages must only be processed when the ProcessMessage method is not processing requests, or when it is waiting for calls to SubmitOrder to return. Which attribute should you apply to the MessageProcessor class? An ASP.NET application hosts a RESTful Windows Communication Foundation (WCF) service at /Services/Contoso.svc. The service provides a JavaScript resource to clients. You have an explicit reference to the JavaScript in your page markup as follows. <script type="text/javaScript" src="/Services/Contoso.svc/js" /> You need to retrieve the debug version of the service JavaScript. What should you do? You are creating a Windows Communication Foundation (WCF) service that accepts claims-based tokens. You need to ensure that the service can use claims from trading partners even though there are variations on naming for the same elements. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.) A Windows Communication Foundation (WCF) solution uses the following contracts. (Line numbers are included for reference only.) 01 [ServiceContract(CallbackContract=typeof(INameService))] 02 public interface IGreetingService 03 { 04 [OperationContract] 05 string GetMessage(); 06 } 07 [ServiceContract] 08 public interface INameService 09 { 10 [OperationContract] 11 string GetName(); 12 } The code that implements the IGreetingService interface is as follows: 20 public class GreetingService : IGreetingService 21{ 22 public string GetMessage() 23 { 24 INameService clientChannel = OperationContext.Current.GetCallbackChannel<INameService>(); 25 string clientName = clientChannel.GetName(); 26 return String.Format("Hello {0}", clientName); 27 } 28 } The service is self-hosted. The hosting code is as follows: 30 ServiceHost host = new ServiceHost(typeof(GreetingService)); 31 NetTcpBinding binding = new NetTcpBinding(SecurityMode.None); 32 host.AddServiceEndpoint("MyApplication.IGreetingService", binding, "net.tcp//localhost:12345"); 33 host.Open(); The code that implements the lNameService interface is as follows: 40 class NameService : INameService 41 { 42 string name; 43 public NameService(string name) 44 { 45 this.name = name; 46 } 47 public string GetName() 48 { 49 return name; 50 } 51 } Currently, this code fails at runtime, and an InvalidOperationException is thrown at line 25. You need to correct the code so that the call from the service back to the client completes successfully. What are two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.) The endpoint of a Windows Communication Foundation (WCF) service uses basicHttpBinding for its binding. Your company's policies have changed to require that messages not be sent in clear text. You must ensure that all messages are encrypted when traveling across the network. What should you do? You are creating a Window Commnunication Foundation (WCF) service application. The application needs to service many clients and requests simultaneously. The application also needs to ensure subsequent individual client requests provide a stateful conversation. You need to configure the service to support these requirements. Which attribute should you add to the class that is implementing the service? You are building a client for a Windows Communication Foundation (WCF) service. You need to create a proxy to consume this service. Which class should you use? You are developing a custom service host for a Windows Communication Foundation (WCF) service. The service host is named MovieServiceHost. You need to deploy the service with the custom service host in Microsoft Internet Information Services (IIS) 7.0. What should you do? You are consuming a Windows Communication Foundation (WCF) service. The service interface is defined as follows: [DataContract(Namespace = ''] public class Item { } [ServiceContract(Namespace = '')] public interface Catalog { [OperationContract] [WebInvoke(Method="POST", UriTemplate="{Item}")] Item UpdateItem(Item item); } The client application receives a WebResponse named response with the response from the service. You need to deserialize this response into a strongly typed object representing the return value of the method. Which code segment should you use? You are modifying a Windows Communication Foundation (WCF) service that issues security tokens. The service is accessible through the named pipe protocol. No endpoints are added in the service code. The configuration file for the service is as follows. (Line numbers are included for reference only) 01 <configuration> 02 <system.serviceModel> 03 <services> 04 <service name="Contoso.TokenService"> 05 ... 06 <host> 07 <baseAddress> 08 ... 09 <add baseAddress="net.pipe://www.contoso.com/tokenpipe" /> 10 <baseAddress> 11 </host> 12 </service> 13 </services> 14 </system.serviceModel> 15 </configuration> You need to ensure that the existing client applications can access the service through HTTP and named pipes. What should you do? A Windows Communication Foundation (WCF) service is deployed with netTcpBinding. This service uses a duplex message exchange pattern.You are developing the next version of the WCF service. You discover that your company's hardware load balancer performs correctly only for WCF services that use HTTP. You need to ensure that your service works with the load balancer. What should you do? You have a self-hosted Windows Communication Foundation (WCF) service. You need to configure the service to provide an X509 certificate during authentication. What should you use to configure the service? You have an existing Windows Communication Foundation (WCF) Web service. The Web service is not responding to messages larger than 64 KB. You need to ensure that the Web service can accept messages larger than 64 KB without generating errors. What should you do? You are creating an application that consumes a Windows Communication Foundation (WCF) service. The service implements the IService contract. The client application contains the CallbackHandler class, which implements IServiceCallback. You need to ensure that a client proxy is created that can communicate with the service over a duplex channel. Which code segment should you use? A self-hosted Windows Communication Foundation (WCF) service uses a secure HTTP binding with a custom principal permission mode. The binding requires users to provide their Windows logon credentials. You need to retrieve the identity of the caller. What are two possible properties you can use to achieve this goal? (Each correct answer presents a complete solution Choose two) You are developing a Windows Communication Foundation (WCF) service that is hosted by a Windows Forms Application. The ServiceHost instance is created in the Form Constructor. You need to ensure that the service is not blocked while the UI thread is busy. What should you do? A Windows Communication Foundation (WCF) service is required to log all authorization attempts to the Windows Event Log. You need to configure a behavior and apply it to the service to support this requirement. Which behavior should you configure and apply?