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.
You are currently busy developing an Extensible Markup Language (XML) Web service. This XML Web service is intended to allow the traffic department to perform driver license verifications in particular geographic areas. To this end you created the following Extensible Markup Language (XML) Web Service class definition as illustrated in the exhibit.

<WebService()> public class LicenseService : WebService
{
private LicenseVerifier _licenceVerifier;
<WebMethod()> public string GetRecentInvalidLicenseHistory()
{
ArrayList invalidLicenses = CType(MyBase.Application.Item(InvalidLicenses”), ArrayList);
return CType(invalidLicenses.ToArray(GetType(String)), String());
}
<WebMethod()> public bool VerifyLicense(string state, string licenseNumber)
bool isValid = Me._licenseVerifier.Verify(geoArea, licenseNumber)

if (! isValid)
{
ArrayList invalidLicenses = Ctype(MyBase.Application.Item(“InvalidLicenses”),ArrayList) invalidLicenses.Aff(LicenseNumber);
}
return isValid;
}
}

The VerifyLicence Web method will verify an individual’s driver license in a particular geographic area.
The ObtainRecentInvalidLicenseHistory will return a list of all the driver licenses that has been revoked regardless of geographic area. You are required to modify the two Web methods so as to prevent them from throwing exception of type NulReferenceException.

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.
You are currently busy developing an Extensible Markup Language (XML) Web service. This XML Web service is intended to allow the traffic department to perform driver license verifications in particular geographic areas. To this end you created the following Extensible Markup Language (XML) Web Service class definition as illustrated in the exhibit.

<WebService()> public class LicenseService : WebService
{
private LicenseVerifier _licenceVerifier;
<WebMethod()> public string GetRecentInvalidLicenseHistory()
{
ArrayList invalidLicenses = CType(MyBase.Application.Item(InvalidLicenses”), ArrayList);
return CType(invalidLicenses.ToArray(GetType(String)), String());
}
<WebMethod()> public bool VerifyLicense(string state, string licenseNumber)
bool isValid = Me._licenseVerifier.Verify(geoArea, licenseNumber)

if (! isValid)
{
ArrayList invalidLicenses = Ctype(MyBase.Application.Item(“InvalidLicenses”),ArrayList) invalidLicenses.Aff(LicenseNumber);
}
return isValid;
}
}

The VerifyLicence Web method will verify an individual’s driver license in a particular geographic area.
The ObtainRecentInvalidLicenseHistory will return a list of all the driver licenses that has been revoked regardless of geographic area. You are required to modify the two Web methods so as to prevent them from throwing exception of type NulReferenceException.

What should you do?

A.
Create an instance of ArrayList if there is no ArrayList in the Application object.

B.
Store and retrieve the ArrayList instance to and from the Session object.

C.
Serialize and deserialize the items in the ArrayList instance using the XmlSerializer class.

D.
In each Web method create an instance of LicenseVerifier.

Explanation:
The application object holds the state information for the Web service and is thus not client-specific. Also if the Application does not have a certain value for the InvalidLicenses key, a null reference (Nothing) is returned. If you try to access members of a null reference, an exception of type NulReferenceException is thrown. Thus you should create an instance of ArrayList if one does not exist in the Application object.
Incorrect answers:
B: The Session object holds state information for each client that is connected to the Web service. This means that the GetRecentInvalidLicenseHistory method will only return licenses that were rendered invalid by a particular Web service client. This you should not store and retrieve the ArrayList instance to and from the Session object.
C: The XmlSerializer allows one to desrialiae and deserilaize an object to and from XML. The GetRecentInvalidLicenseHistory method returns a String Array which is supported by Web Services Description Language (WSDL). Thus you should not serialize and deserialize the items in the ArrayList instance using the XmlSerializer class
D: A LicenseVerifier instance is created during the construction of the LicenseService class and this construction takes place after the Web method is called due to Web services being inherently stateless. Thus you should not create an instance of LicenseVerifier in each Web method.



Leave a Reply 0

Your email address will not be published. Required fields are marked *