PrepAway - Latest Free Exam Questions & Answers

Category: 70-513

Exam 70-513: TS: Windows Communication Foundation Development with Microsoft .NET Framework 4

Which code segment should you use?

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?

What should you do?

A Windows Communication Foundation (WCF) service implements the following contract.
(Line numbers are included for reference only.)

01 [ServiceContract]
02 public interface IDataAccessService
03 {
04 [OperationContract]
05 void PutMessage(string message);
06 …
07 [OperationContract]
08 [FaultContract(typeof(TimeoutFaultException))]
09 [FaultContract(typeof(FaultException))]
10 string SearchMessages(string search);
11 }

The implementation of the SearchMessages method throws TimeoutFaultException exceptions for database timeouts.
The implementation of the SearchMessages method also throws an Exception for any other issue it encounters while processing the request.
These exceptions are received on the client side as generic FaultException exceptions.

You need to implement the error handling code for SearchMessages and create a new channel on the client only if the channel faults.
What should you do?

What should you do?

A Windows Communication Foundation (WCF) solution exposes the following contract over an HTTP connection.

[ServiceContract]
public interface IDataService
{
[OperationContract]
string GetData();
}

Existing clients are making blocking calls to GetData. Calls to GetData take five seconds to complete.
You need to allow new clients to issue non-blocking calls to get the data, without breaking any existing clients. What should you do?

What are two possible ways to achieve this goal?

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.)

Which code segment should you use?

A Windows Communication Foundation (WCF) client configuration file contains the following XML segment in the system.serviceModel element.

<client>
<endpoint address=”net.tcp://server/ContosoService”
binding=”netTcpBinding”
contract=”Contoso.IContosoService”
name=”netTcp”/>
<endpoint address=”net.pipe://localhost/ContosoService”
binding=”netNamedPipeBinding”
contract=”Contoso.IContosoService”
name=”netPipe” />
</client>

You need to create a channel factory that can send messages to the endpoint listening at net.pipe://localhost/ContosoService.
Which code segment should you use?

which order should the binding stack be configured?

You are creating a Windows Communication Foundation (WCF) service. You have the following requirements:
* Messages must be sent over TCP
* The service must support transactions.
* Messages must be encoded using a binary encoding
* Messages must be secured using Windows stream-based security.

You need to implement a custom binding for the service. In which order should the binding stack be configured?

Which code segment should you use at line 10?

You are working with a Windows Communication Foundation (WCF) client application that has a generated proxy named SampleServiceProxy.
When the client application is executing, in line 04 of the following code, the channel faults (Line numbers are included for reference only.)

01 SampleServiceProxy proxy = new SampleServiceProxy();
02 try
03 {
04 proxy.ProcessInvoice(invoice);
05 }
06 catch
07 {
08 if(proxy.State == CommunicationState.Faulted)
09 {
10 …
11 }
12 }
13 proxy.UpdateCustomer(customer);

You need to return proxy to a state in which it can successfully execute the call in line 13.
Which code segment should you use at line 10?

You need to implement CreateHost so that the service has a single endpoint hosted at…

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?


Page 13 of 15« First...1112131415