Ensurepass

QUESTION 51

HOTSPOT

You are developing a Windows Communication Foundation (WCF) service. You implement a data contract to pass complex data to and from the service. The service includes the following code:

 

clip_image001

 

You need to verify the order in which the data is serialized.

 

For each of the following statements, select True if the statement is true. Otherwise select False.

 

clip_image002

 

Correct Answer:

clip_image003

 

 

QUESTION 52

You want to debug the Windows Communication Foundation (WCF) client and server interaction through message and application tracing. You need to correlate traces generated on the client and the server. Which XML segment should you add to the system. diagnostics configuration element in the client and server application configuration file?

 

A.

<sources> <source propagate Activitye’true” names”System Service Model”

switchValues’Warning, ActivityTracing’> <listeners

<add namez”ServiceModelTraceListener” /> </listeners>

</source> </sources>

B.

<sources> <source names” System ServiceModel. MessageLogging”

switchValuee”Verbose”> <listeners>

<add namez”ServiceModelTraceListener” /> <Listeners>

</source> </sources>

C.

<sources>

<source names”System. ServiceModeiMessageLogging”

propagateActivitye’true” switch Values’ Warning, ActivityTracing’5

<listeners> <add name=”ServiceModelTraceListener” I> </listeners>

</source> </sources>

D.

<sources>

<source names”System. ServiceModel” switchValues’VerboseActivityTracing”> <listeners>

<add namee”ServiceModelTraceListener” /> </listeners>

</source> </sources>

 

Correct Answer: A

 

 

QUESTION 53

You are maintaining a Windows Communication Foundation (WCF) service that uses a custom UserNamePassword class to authenticate clients. The service certificate is hosted in the deployment server store for trusted root certificate authorities and has a Subject value of TaxServiceKey. Other service certificates hosted on the server also use TaxServiceKey as a Subject value. You need to ensure that the service identifies itself with a certificate whose subject name and distinguished names are TaxServiceKey. Which code segment should you use?

 

A.

HostInstance.Credentials.ServiceCertificate.SetCertificate

(StoreLocation.LocalMachine, StoreName.My,

X509FindType.FindBySubjectName,

“CN=TaxServiceKey”)

B.

HostInstance.Credentials.ServiceCertificate.SetCertificate

(StoreLocation.LocalMachine, StoreName.AuthRoot,

X509FindType.FindBySubjectName, “CN=TaxServiceKey”)

C.

HostInstance.Credentials.ServiceCertificate.SetCertificate

(StoreLocation.LocalMachine, StoreName.My,

X509FindType.FindBySubjectDistinguishedName,

“CN=TaxServiceKey”)

D.

HostInstance.Credentials.ServiceCertificate.SetCertificate

(StoreLocation.LocalMachine, StoreName.Root,

X509FindType.FindBySubjectDistinguishedName,

“CN=TaxServiceKey”)

 

Correct Answer: D

 

 

QUESTION 54

You develop a Windows Communication Foundation (WCF) service that employees use to access bonus information. You define the following service contract. (Line numbers are included for reference only.)

 

01 <ServiceContract(SessionMode:=SessionMode.Required)>

 

02 Public Interface IFinancialService

 

03

 

04 <OperationContract()>

 

05 Function Login(

 

ByVal employeeID As Integer,

 

ByVal passwordHash As String)

 

As String

 

06

 

07 <OperationContract()>

 

08 Function GetBonus(ByVal month As Integer) As Double

 

09

 

10 <OperationContract

 

(IsTerminating:=True)>

 

11 Sub Logout()

 

12

 

13 End Interface

 

Client applications can invoke methods without logging in.

 

You need to ensure that the client applications invoke Login before invoking any other method.

 

You also need to ensure that client applications cannot consume the service after invoking Logout.

 

Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

 

A.

Replace line 04 with the following code.

<OperationContract(IsInitiating:=False)>

B.

Replace line 04 with the following code.

<OperationContract(IsInitiating:=True, IsTerminating:=True)>

C.

Replace line 07 with the following code.

<OperationContract(IsInitiating:=False)>

D.

Replace line 10 with the following code.

<OperationContract(IsInitiating:=False, IsTerminating:=True)>

 

Correct Answer: CD

 

 

QUESTION 55

The following is an example of a SOAP envelope.

 

<s:Enelope xmlns:se’http://schemas.xmlsoporg/soap/envelopef’>

 

<s: Header> <h:Storeld xmlns:he”http:/!www.contoso.com”s

 

6495

 

<Ih: Storeld>

 

</s:Header>

 

<s:Body>

 

<CheckStockRequest xmlnsehttp://wwwcorIosocom”>

 

<ltemld>2469 <Iltenld>4

 

</CheckStoc kRequest>

 

<Is: Body>

 

<Is: Envelope>

 

You need to create a message contract that generates the SOAP envelope.

 

Which code segment should you use?

 

A.

[MessageContract(WrapperName=”http://www. contoso. comn”)]

public class CheckStockRequest

{

[MessageHeader(Nanez”http://www.contoso.com”)] public mnt Storeld{get; set.}

[MessageBodyMember(Namee’intp://www.contoso.com”)] public nit itemld{get set;)

}

B.

[MessageContract(WrapperNamespace=”http:I/www.contoso.comn”)]

public class CheckStoc kRequest

{

[MessageHeader(Namespaces”http://www.contosocom”)]

public nmt Storeld{get; set;)

[MessageBodyMember(Namespaces”http://www. contoso . comn”)]

public nmt ltemld{get; set;}

}

C.

[MessageContract(WrapperNamespace=”http://www. contosocom”)]

public class CheckStockRequest

{

[MessageHeader(Na-mespacesttp://wwwcontoso. comn”)]

public mnt Storeld{get set.}

public mnt ltemld{get: set;}

)

D.

(MessageContract(WrapperNamespace=”http://www. contoso.com”)]

public class CheckStockRequest

{

[MessageHeader(Namespacehttp://www. contoso. comn”)]

public int Storeld{get set;}

(MessageBodyMember]

public int ltemmld(get set}

}

 

Correct Answer: B

 

 

QUESTION 56

You are creating a Window s Communication 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?

 

A.

<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession, ConcurrencyMode:=ConcurrencyMode.Single)>

B.

<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerCall, ConcurrencyMode:=ConcurrencyMode.Reentrant)>

C.

<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerSession, ConcurrencyMode:=ConcurrencyMode.Multiple)>

D.

<ServiceBehavior(InstanceContextMode:=InstanceContextMode.PerCall, ConcurrencyMode:=ConcurrencyMode.Multiple)>

 

Correct Answer: C

 

 

QUESTION 57

A class named TestService implements the following interface.

 

clip_image004

 

TestService is hosted in an ASP.NET applicator.

 

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

 

What should you do?

 

A.

Add this attribute to the GetServiceTime method

<webinvoke(Method “POST)>

In the bconfig file, add this element to systemserviceModeI/behaviors/endpointBehaviors.

<behavior

names”Json”>e

<enableWebScript

c/behavior>

In the web.config file, configure TestService in the system.serviceModel/services collection as follows:

<service name”TestService”>

<endpoint address/ServiceTime”

contract-“TestSerAce””

behaviorConlfgurationz’Json

bindinge”webHttpBinding”!> <!services

B.

Add this attribute to the GetServiceTime method

<Webinvoke(Method PGETw,

UrTemplate:eiSeneiceTim&, ResponseFormat: WebMessageFormatJson)>

In the bconfIg file, configure TestService in the system.arviceModeI/services collection as follows:

<senvice names”TestService”>

<endpoint ad&esse”ISer,iceTime”r contracte”TestSence’ bindingewebHttpBindngw />

c/service>

C.

Add this attribute to the GetServiceTime method

<webGet(

ResponseFormat WebMessageFormatJson,

UnTemplate:eJServiceTime”)>?

Create a new svc file named Jsonversion svc with the following contract <%@ ServiceHost Servicee”TessService”i

Factory=”System ServiceModelktivation WebServiceHosFactory” %s

D.

Add this attribute to the GetServiceTime method

<WebGet(UriTempbte: z”{Json}/ServiceTime”)>

Create a new svc file named Jsonversionsvc with the following contert <%@ ServiceHost Service=”TestSenvice”

Factoryz’System Se viceMode[ktivationWebServiceHodFactory” %>

 

Correct Answer: C

 

 

QUESTION 58

A Windows Communication Foundation (WCF) service is responsible for transmitting XML documents between systems. The service has the following requirements:

 

clip_image006It must minimize the transmission size by attaching the XML document as is without using escape characters or base64 encoding.

clip_image006[1]It must interoperate with systems that use SOAP but are not built on the .NET platform.

 

You need to configure the service to support these requirements. Which message encoding should you use?

 

A.

Binary message encoding

B.

MTOM (Message Transmission Optimization Mechanism) message encoding.

C.

Text message encoding with message version set to none.

D.

Text message encoding with message version set to SOAP 1.2.

 

Correct Answer: B

 

 

QUESTION 59

DRAG DROP

You use Visual Studio to develop a Windows Communication Foundation (WCF) service. The service is not hosted. You cannot use the WcfTestClient.exe tool to test the service. You need to test the service from a separate Visual Studio solution that contains a simple console application. Which four actions should you perform in sequence? (To answer, move the appropriate four actions from the list of actions to the answer area and arrange them in the correct order.)

 

clip_image008

 

Correct Answer:

clip_image010

 

QUESTION 60

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 Sub PutMessage(ByVal message As String)

 

06

 

07 <OperationContract()>

 

08 <FaultContract(GetType(TimeoutFaultException))>

 

09 <FaultContract(GetType(FaultException))>

 

10 Function SearchMessages(ByVal search As String) As String ()

 

11

 

12 End Interface

 

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?

 

A.

Catch and handle both TimeoutFaultException and FaultException.

B.

Catch both TimeoutFaultException and FaultException. Create a new channel in both cases.

C.

Catch and handle TimeoutFaultException. Catch FaultException and create a new channel.

D.

Catch and handle FaultException. Catch TimeoutFaultException and create a new channel.

 

Correct Answer: C

 

 

Instant Access to Download Latest Complete Collection of Microsoft 70-513 Real Exam

Try Microsoft 70-513 Free Demo