Configuring and customizing a Web service application

These questions are based on Cert-70-554VB – MSCert: UPGRADE – MCSD Microsoft .NET Skills to MCPD Enterprise Application Developer Using the Microsoft .NET Framework: Part 2 – Section 1 Microsoft Developer Self-Test Software Practice Test.


Objective: Configuring and customizing a Web service application
SubObjective: Configure SOAP messages


Single Answer, Multiple Choice


As an enterprise application developer, you have created the following Web service for ESoft contractors:


<WebServiceBinding(Name:=”PartnerBinding”, _
Namespace:=”http://www.GeoTrek.com/ESoft”)> _
<WebServiceBinding(Name:=”ExternalBinding”, _
Namespace:=”http://www.ESoft.com/External”, _
Location:=”http://www.ESoft.com/External/ContractSevice.xsd”)> _
<WebService(Namespace:=”http://www.ESoft.com/internal”)> _
Public Class ContractService
                Inherits System.Web.Services.WebService


                Public Sub MakePayment(ByVal amount As Double)
                                ‘implementation
                End Sub


                Public Sub AdjustRate(ByVal amount As Double)
                                ‘implementation
                End Sub
End Class


The MakePayment method should be available to external contractors while the AdjustRate method must remain internal to ESoft. What should you do?



  1. Apply the following attribute to the MakePayment method:
    <SoapDocumentMethod (Binding := “PartnerBinding”)> _
    Apply the following attribute to the AdjustRate method:
    <SoapDocumentMethod (Binding = “ExternalBinding”)> _


  1. Apply the following attribute to the AdjustRate method:
    <SoapDocumentMethod (Binding = “ESoftBinding”)> _


  1. Apply the following attribute to the MakePayment method:
    <SoapDocumentMethod (Binding = “ExternalBinding”)> _


  1. You do not need to do anything in this scenario.

Answer:



  1. Apply the following attribute to the MakePayment method:
    <SoapDocumentMethod (Binding = “ExternalBinding”)> _

Tutorial:
You should apply the following attribute to the MakePayment method as follows:


<SoapDocumentMethod (Binding = “ExternalBinding”)> _
Public Sub MakePayment(ByVal amount As Double)
                ‘implementation
End Sub


This will bind the MakePayment Web method to the binding named ExternalBinding, while the AdjustRate will remain available only through the default binding.


A binding is an interface of ports and operations in a Web service. Each binding represents a different set of available Web methods accessible through specified ports. To specify the available bindings for a Web service, the WebServiceBinding attribute is applied to the Web service. You either use the default binding for a Web service method or explicitly specify a binding by using the binding property of the SoapDocumentMethod or SoapRpcMethod attributes.


The WebServiceBinding attribute has five properties for each binding you apply to a Web service:



  • Name: The name of the binding. This is used internally as the binding property for the SoapDocumentMethod or SoapRpcMethod attribute.
  • Namespace: The namespace for the messages of the binding. If not specified, the default namespace is used.
  • Location: The location where the binding messages are defined. If not specified, the binding is assumed to be defined in the current Web service WSDL file. The WebServiceBinding attribute also provides two other properties:
  • ConformsTo: The Web Service Interoperability (WS-I) specification to which the binding conforms. The only supported WS-I profile is the Basic Profile Version 1.1 (BasicProfile1_1).
  • EmitConformanceClaims: Whether the conformance specified in the ConformsTo property is provided when a WSDL description of the Web service is published.

You should not associate the MakePayment method with the PartnerBinding binding and the AdjustRate method with the ExternalBinding binding because the MakePayment method should be external to all contractors and the AdjustRate method should be locally available only. You should have associated the MakePayment method with the ExternalBinding binding and kept the AdjustRate method associated with the local binding.


You should not associate the AdjustRate method with the ESoftBinding binding because no such binding is specified using the WebServiceBinding attribute. You should have associated the MakePayment method with the ExternalBinding binding and kept the AdjustRate method associated with the local binding.


You should not do nothing in this scenario because both the MakePayment and AdjustRate methods will remain with the local binding by default. In this scenario, MakePayment method should be external to all contractors. You should have associated the MakePayment method with the ExternalBinding binding.


Reference:
MSDN2 Library, Search, “.NET Development,” “.Net Framework SDK,” “Class Library Reference,” “System.Web.Services.Protocol,” “SoapDocumentMethodAttribute Class,” “Binding Property.”


MSDN2 Library, Search, “.NET Development,” “.Net Framework SDK,” “Class Library Reference,” “System.Web.Services,” “WebServiceBindingAttribute Class.”

Like what you see? Share it.Google+LinkedInFacebookRedditTwitterEmail
cmadmin

ABOUT THE AUTHOR

Posted in Archive|

Comment: