Ensurepass

QUESTION 61

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:

 

Sub DeleteItems (ByVol id As String)

 

You need to configure WCF to call this method when the client calls the service with the HTTP DELETE operation.

 

What should you do?

 

A.

Add the WebInvoke(UriTemplate: = “/Items/{id>”, Method: = “DELETE”) attribute to the operation.

B.

Add the HttpDelete attribute to the operation.

C.

Replace the string parameter with a RemovedActivityAction parameter.

D.

Change the Sub statement to Function and specify RemovedActivityAction as the return type.

 

Correct Answer: A

 

 

QUESTION 62

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. IContoso Service “

 

name=” netTcp ” / >

 

<endpoint address=” net.pipe://localhost/ContosoService “

 

binding=” netNamedPipeBinding “

 

contract=” Contoso. IContoso Service “

 

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

 

A.

Dim factory As ChannelFactory (Of Contoso. IContosoService ) =

New ChannelFactory (Of Contoso. IContosoService )(” Contoso. IContosoService “)

B.

Dim factory As ChannelFactory (Of Contoso. IContosoService ) =

New ChannelFactory (Of Contoso. IContosoService )(” netNamedPipeBinding “)

C.

Dim factory As ChannelFactory (Of Contoso. IContosoService ) =

New ChannelFactory (Of Contoso. IContosoService )(” netPipe “)

D.

Dim factory As ChannelFactory (Of Contoso. IContosoService ) =

New ChannelFactory (Of Contoso. IContosoService )( ” net.pipe://localhost/ContosoService “)

 

Correct Answer: D

 

 

QUESTION 63

A Windows Communication Foixdation (WCF) solution uses the following contracts

 

(Line numbers are included for reference only)

 

01 eServiceContract(Callback contract: GetType(lNameService))>

 

02 Putlic Interface I(IeetingService

 

03

 

04 <OperationContractO>

 

05 Function GetMessage() As Stnng

 

06

 

07End Interface

 

08

 

09 <ServiceContractO>

 

10 Public Interface INameService

 

11

 

12 <OperationContractO>

 

13 Function GetName() As String

 

14

 

15 End Interface

 

The code that implements the KleetingService interface is as follows:

 

20 Public Class GretingService

 

21 Impements lGreaingService

 

22

 

23 Public Function GetMessage0As String –

 

24 lmpements IGredingService. GetMessage

 

25

 

26 Dim clientChann As INameService =

 

27 OperationContet. Current.

 

28 GetCallbackChamel(Of INameService)()

 

29 Dim clientName As String = clientChannelGetName()

 

30  Retumn String Format(“Hello {O)”, clientName)

 

31

 

32 End Function

 

33 hnd Class

 

The service is self-hosted The hosting code is as follows:

 

35 Dim host As SeniceHost =

 

36 New ServiceHost(GetType(GrstingService))?

 

37 Dim binding As NetTcpBinding =

 

38 New NetTcpBinding(Sec urityMode. None)

 

39 hostAddServiceEndpoint(‘Myapplication lGreetingService”.

 

40 bincng, net.tcp:Ilocalhost: 12345W)

 

41 HotOpen()l

 

The code that implements the INameService interface is as follows:

 

42 Class NameService

 

43 lmpements INameService

 

44

 

45 Dim name As String

 

46

 

47 Public Sub NameService(ByV name As String)

 

48 Me.reme = name

 

49 End Sub

 

50

 

51 Public Function GetName() As String –

 

52 lmpements INameService. GeName

 

53

 

54 Reti.rn name

 

55 End Function

 

56 End Class Currently, this code fails at runtime, and an Invalid Operation Exception is thrown at mne 25.

 

You need to correct the code so that the call from the service back to the client complets successfully

 

What e two possible ways to achieve this goal? (Each correct answer presents a complete solution. Choose two.)

 

A.

Change the service contract definition in line 01 as follows.

<ServiceContract(CallbackContract: sGetType(lNameService), SessionMode =SessknMode Required)>

B.

Add the following attribute to the NameService class, before line 42.

<ServiceBehavior(ConcurrencyMode ConcisrencyMode. Reentrant)>

C.

Add the following attribute to the GreetingSenAce class, before line 20.

<ServiceBehavior(ConcurrencyMode: zConctrencyMode Reentrant)>

D.

Add the following attribute to the GreetingSence class, before line 20.

<ServiceBehavior(ConcurrencyMode: ConcurrencyMode. Multiple)>

 

Correct Answer: CD

 

 

QUESTION 64

You are developing a new version of an existing message contract named CustomerDetailsVersion1. The new version of the message contract must add a Department field of type String to the SOAP header. You create a new class named CustomerDetailsVersion2 that inherits from CustomerDetailsVersion1. You need to ensure that all client applications can consume the service. Which code segment should you use?

 

A.

<MessageContract() >

Public Class CustomerDetailsVersion2 Inherits CustomerDetailsVersionl

<MessageHeader(HustUnderstand:=False)>

Public Department As String

End Class

B.

Public Class CustomerDetailsVersion2 Inherits

CustomerDetailsVersionl

<MessageHeader(MustUnderstand:=True)> Public

Department As String

End Class

C.

Public Class CustomerDetailsVersion2 Inherits CustomerDetailsVersionl

<MessageHeader(HustUnderstond:”True)> Public Department As String

End Class

D.

Public Class CustomerDetailsVersion2 Inherits

CustomerDetailsVersionl

<MessageHeader(HustUnderstand:=False) > Public

Department As String

End Class

E.

<MessageContract()>

Public Class CustomerDetailsVersion2 Inherits

CustomerDetailsVersionl

<MessageHeader(HustUnderstand:=True)> Public

Department As String

End Class

 

Correct Answer: A

 

 

QUESTION 65

You are creating a Windows Communication Foundation (WCF) service that accepts messages from clients when they are started. The message is

 

defined as follows:

 

<MessageContract()>

 

Public Class Agent

 

Public Property CodeName As String

 

Public Property SecretHandshake As String

 

End Class

 

You have the following requirements:

 

clip_image002The CodeName property must be sent in clear text. The service must be able to verify that the property value was not changed after being sent by the client.

clip_image002[1]The SecretHandshake property must not be sent in clear text and must be readable by the service.

 

What should you do?

 

A.

Add a MessageBodyMember attribute to the CodeName property and set the ProtectionLevel to Sign. Add a MessageBodyMember attribute to the SecretHandshake property and set the ProtectionLevel to EncryptAndSign.

B.

Add a DataProtectionPermission attribute to the each property and set the ProtectData property to True.

C.

Add an XmlText attribute to the CodeName property and set the DataType property to Signed. Add a PasswordPropertyText attribute to the SecretHandshake property and set its value to True.

D.

Add an ImmutableObject attribute to the CodeName property and set its value property to True. Add a Browsable attribute to the SecretHandshake property and set its value to False.

 

Correct Answer: B

 

 

QUESTION 66

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 02 of the following code, the channel faults (Line numbers are included for reference only.)

 

01 SampleServiceProxy proxy new SampleServiceProxy()

 

02 try

 

03 {

 

04 proxy Processlnvoice(invoice);

 

05)

 

06 catch

 

07 {

 

08 (proxy. State == CommunicationState. Faulted)

 

09 {

 

10

 

11)

 

12)

 

13 proxy Update Customer(customer);

 

You need to retumn proxy to a state in which it can successfully execute the call in line 13.

 

Which code segment should you use at line 10?

 

A.

proxy.CloseO;

B.

proxy new SampleServiceProxy0;c

C.

proxy.AbortO,

D.

proxy.Open()

 

Correct Answer: C

 

 

 

 

 

 

 

 

 

QUESTION 67

A Windows Communication Foundation (WCF) solution uses two services to manage a shopping cart. Service A processes messages containing line items that total between $0 and $500. Service B processes messages containing line items that total more than $500. All messages are of equal importance to the business logic. You need to route incoming messages to the appropriate services by using WCF routing. Which two message filters should you add to the router? (Each correct answer presents part of the solution. Choose two.)

 

A.

a message filter with a priority of 100 that will forward messages that total between $0 and $500 to Service A

B.

a message filter with a priority of 0 that will forward messages that total between $0 and $500 to Service A

C.

a message filter with a priority of 0 that will forward all messages to Service B

D.

a message filter with a priority of 100 that will forward all messages to Service B

 

Correct Answer: AC

 

 

QUESTION 68

You are developing a Windows Communication Foundation (WCF) service. One of the parameters used with the service operations is a security token. The security token is not sensitive. The monitoring software tracks security tokens and can read tokens in clear text only. The company security policy requires that you validate all clear text data passed over the corporate network. You need to ensure that the service verifies that the security token is not changed during transit. What should you do?

 

A.

For all the security-sensitive members, set the ProtectionLevel parameter of the MessageBodyMember or MessageHeader attribute to EncryptAndSign.

B.

Implement IEndpointldentityProvider in the message contract class.

C.

Implement ISecureConversationSession in the message contract class.

D.

For all the security-sensitive members, set the ProtectionLevel parameter of the MessageBodyMember or MessageHeader attribute to Sign.

 

Correct Answer: D

 

 

QUESTION 69

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:

 

string oid Deleteltems(string id);

 

You need to configi.re WCF to ci this method when the client calls the service with the HTTP DRETE opera on.

 

What should you do?

 

A.

Add the Weblnvoke(UriTemplate = “/Items/(idy,

Method=”DELETE”) attribute to the operation

B.

Add the HttpDelete tribute to the operation

C.

Replace the sting parameter with a RemovedActivityAction parameter

D.

Replace the return type with RemovedActivityktion.

 

Correct Answer: A

 

 

QUESTION 70

DRAG DROP

You have a client application that consumes a Windows Communication Foundation (WCF) service. The service contains a class named RegistrationService. The RegistrationService class contains two methods named SubmitRegistration and GetRegistrations.

 

The service has the following requirements:

 

clip_image002[2]The client application must call the SubmitRegistration method synchronously.

clip_image002[3]The client application must call the GetRegistrations method asynchronously.

 

You need to complete the client-side code to call the WCF service.

 

Which six code segments should you use in sequence? (To answer, move the appropriate six code segments from the list of code segments to the answer area and arrange them in the correct order.)

 

clip_image004

 

Correct Answer:

clip_image006

 

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

Try Microsoft 70-513 Free Demo