PrepAway - Latest Free Exam Questions & Answers

What should you do?

You work as the Microsoft.NET developer at Domain.com. The Domain.com network consists of a single Active Directory domain named Domain.com. All servers in the domain run Windows Server 2003. The configuration and customization of Web Service applications forms part of your responsibilities at Domain.com. Domain.com operates as a real estate and property management company.
A class named PropertyManagement holds a shared method named ObtainProperties. ObtainProperties is configured to accept a String parameter that identifies a client and return a DataSet instance that holds all the properties that are managed by that client. The client identifier is a Microsoft Windows Active Directory user name.
You received instruction to create an Extensible Markup Language (XML) Web Service that makes use of Windows Authentication to expose this functionality to the Internet. However, you need to ensure that your solution also enhances the Web server performance. To this end you need to save the property results in memory on the Web server.

What should you do? (Choose the correct code segment.)

PrepAway - Latest Free Exam Questions & Answers

A.
Public Class PropertyManagementService
<WebMethod(EnableSession:=True)> _
Public Function ObtainProperties() As DataSet
Dim dataset As DataSet = Nothing
dataSet = CType(Session(“Properties”), DataSet)
If (dataSet Is Nothing) Then
dataSet = PropertyManagement.ObtainProperties(User.Identity.Name) Session(“Properties”) = dataSet
End If
Return dataSet
End Function
End Class

B.
Public Class PropertyManagementService
Inherits WebService
<WebMethod(EnableSession:=True)> _
Public Function ObtainProperties() As DataSet
Dim dataset As DataSet = CType(Session(“Properties”), DataSet) If (dataSet Is Nothing) Then
dataSet = PropertyManagement.ObtainProperties(User.Identity.Name) Session(“Properties”) = dataSet
End If
Return dataSet
End Function
End Class

C.
<WebService()> _
Public Class PropertyManagementService
Inherits WebService
<WebMethod()> _
Public Function ObtainProperties() As DataSet
Dim dataset As DataSet = CType(Application(“Properties”), DataSet) If (dataSet Is Nothing) Then
dataSet = PropertyManagement.ObtainProperties(User.Identity.Name) Application(“Properties”) = dataSet
End If
Return dataSet
End Function
End Class

D.
<WebService()> _
Public Class PropertyManagementService
<WebMethod()> _
Public Function ObtainProperties() As DataSet
Dim dataset As DataSet = Nothing
dataSet = CType(Application(“Properties”), DataSet) If (dataSet Is Nothing) Then
dataSet = PropertyManagement.ObtainProperties(User.Identity.Name) Application(“Properties”) = dataSet
End If
Return dataSet
End Function
End Class

Explanation:
The Web service class should be derived from the WebService, set the EnableSession property of the WebMethod attribute to true and use the Session object to save and retrieve properties. The session object holds information for each client that is connected to the Web service. This in turn will allow the results to be saved in memory on a per-client-basis. The base WebService class provides access to the Session object and the EnableSession property will indicate that the Web method makes use of the Session object.
Incorrect answers:
A: The Web service class must be derived from the Web service because the WebService class provides access to the Session object.
C: The Application object should not be used to store and retrieve information. This object holds the state information for the Web service and is thus not client specific.
D: The Application object should not be used to store and retrieve information. This object holds the state information for the Web service and is thus not client specific.


Leave a Reply