While implementing SOAP protocol to consume the Web Service, we need to define 2 important attributes for that class:
WebServiceBindingAttribute:
This attribute’s “Name” property maps to a specific binding (FlightServiceSoap in our example) from the WSDL document (shown in Fig 12). As we have seen earlier a binding is like an “interface” and should be implemented with each protocol.
Fig 12: binding mapping to the WebServiceBindingAttribute
In our example it would be:
[System.Web.Services.WebServiceBindingAttribute(Name="FlightServiceSoap", Namespace=http://tempuri.org/)]
SoapDocumentMethodAttribute:
This attribute holds the value of the “soapAction” attribute of operation element defined in the “FlightServiceSoap” binding. Shown in the Fig 13 below.
Fig 13: SoapDocumentMethodAttribute mapping in WSDL document
In our example it would be:
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetFlightStatus", Use=System.Web.Services.Description.SoapBindingUse.Literal,ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
The other two properties “Use” and “ParameterStyle” are set to the default values. These parameters are used to set the format of the SOAP request or response sent to or from the Web Service. Hence this attribute is optional.