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. The traffic department will send a SOAP request similar to the one illustrated in the exhibit.
<soap:envelope>
<soap:body>
<state xmlns=”urn:gov:DOT”>GA</state>
<licenseNumber xmlns+”urn:gov:DOT”>111222333</LicenseNumber> </soap:body>
<soap:envelope>
You have created a Web method named VerifyLicense. And now you need to apply an attribute to the VerifyLicence method to enable it to support the SOAP requests which will be sent to it.
What should you do? (Choose the correct code segment.)
A.
<SoapDocumentMethod(“urn:gov:DOT”, Use:=SoapBindingUse.Encoded, ParameterStyle:=SoapParameterStyle.Wrapped)>
B.
<SoapDocumentMethod(“urn:gov:DOT”, Use:=SoapBindingUse.Literal, ParameterStyle:=SoapParameterStyle.Wrapped)>
C.
<SoapDocumentMethod(“urn:gov:DOT”, Use:=SoapBindingUse.Literal, ParameterStyle:=SoapParameterStyle.Bare)>
D.
<SoapDocumentMethod(“urn:gov:DOT”, Use:=SoapBindingUse.Encoded, ParameterStyle:=SoapParameterStyle.Bare)>
Explanation:
SoapDocumentUse.Literal will indicate that literal formatting should be used. This in turn means that elements do not need to explicitly specify their types because the elements would be included in the definitions section of the Web Services Description Language (WSDL) document.
SoapParameterStyle.Bare will indicate that parameters may exist as immediate children of the body element in the SOAP request. In this case the LicenseNumber parameter element does not explicitly define its type. Furthermore it exists as an immediate child element of the body element.
Incorrect answers:
A: Both sections in this option are incorrect. The ParameterStyle property should not be set to SoapParameterStyle.Wrapped as this will indicate that the parameter elements have to exist within a single child element of the body element and the Use property should not be set to SoapDocumentUse.Encoded as this indicates that the parameter elements must explicitly define their types.
B: The ParameterStyle property should not be set to SoapParameterStyle.Wrapped as this will indicate that the parameter elements have to exist within a single child element of the body element.
D: The Use property should not be set to SoapDocumentUse.Encoded as this indicates that the parameter elements must explicitly define their types.