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.
You are currently busy developing an Extensible Markup Language (XML) Web Service named MarketService. This MarketService will be used by the Domain.com Marketing department. You are now required to create a Web method named ObtainMarket. The ObtainMarket Web method must return global posisioning system (GPS) coordinates of a mobile phone given a mobile phone number.
In you development of the ObtainMarket Web method, you must ensure that it can be uniquely identified among all the Web services that are implemented by the Sales and Transport departments.

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

PrepAway - Latest Free Exam Questions & Answers

A.
<WebService(Name:=”MarketService”)>
public class MarketService : WebService
{
<WebMethod(MessageName:=”urn:gov:dot:MarketServices”> public string ObtainMarket(string mobilePhoneNumber)
{
return String.Empty;
}
}

B.
<WebService(Namespace:=”urn:gov:dot:MarketServices”)>
public class MarketService : WebService
{
<WebMethod()> public string ObtainMarket(string mobilePhoneNumber)
{
return String.Empty;
}
}

C.
<WebService(Name:=”MarketService)>
public class LocationService : WebService
{
<WebMethod> public string ObtainMarket(string mobilePhoneNumber)
{
return String.Empty;
}
}

D.
<WebService()>
public class LocationService : WebService
<WebMethod>(MessageName:=”urn:gov:dot:LocationServices”)> public string ObtainMarket(string mobilePhoneNumber)
{
return String.Empty;
}
}

Explanation:
The namespace property of the WebService attribute should be set to a name that is unique within the organization. When WSDL is generated for the Web service, it will define the request and response messages that are associated with a Web method to be part of the namespace that you set, thus ensuring unique messages.
Incorrect answers:
A: The MessageName property allows you to uniquely identify an overloaded Web method, thus you should not set the MessageName property of the Web Method.
C: The Name property allows you to change the name of the WSDL element that represents the Web service, thus the name property should not be set to uniquely identify the Web method.
D: The MessageName property allows you to uniquely identify an overloaded Web method, thus you should not set the MessageName property of the Web Method.


Leave a Reply