11.07.2015 Views

y - Net Developer

y - Net Developer

y - Net Developer

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

amrameshreddy.blog.com432 APPENDIX B ■ HISTORY OF MICROSOFT WEB SERVICE IMPLEMENTATIONSramrameshreddy.blog.comISAPI extension (aspnet_isapi.dll) and processed in a separate ASP.NET worker process. TheASMX file must either reference a .NET class or contain the class itself. The only mandatoryentry in the ASMX file is the WebService directive, which specifies the class and the language.Listing B-1 shows an example of the directive where the class being used is Customers.Listing B-1. WebService Directive in an .asmx FileYou can set the default XML namespace for the web service by applying the WebServiceattribute to the class implementing the web service; in addition, you should change thedefault namespace from http://tempuri.org to something unique. Methods of this class donot have the ability to process web service requests. To make the methods available through aweb service, you need to apply a WebMethod attribute to the public method. Once these methodsare decorated with the WebMethod attribute, they are called web methods and cancommunicate over the wire. This class can also optionally derive from the WebService class,which allows the web service to gain access to the common ASP.NET objects such as User,Context, Session, Application, and so on. Listing B-2 shows a sample containing two publicmethods; one is a web service, and the other is not because we have the WebMethod attributeon only one method.Listing B-2. Defining Web Service Methodsusing System.Web.Services;using System;[WebService(Namespace="http://www.quickreturn.com/")]public class CalculateReturn: WebService{[WebMethod]public int Multiply(int a, int b){return a * b;}public int Add(int a, int b){return a + b;}}ramrameshreddyramrameshreddyWeb Services Enhancements (WSE)Web Services Enhancements (WSE, pronounced as “wizzy”) is a set of .NET class libraries;WSE is an add-on to the .NET Framework and provides support for several WS-* specifications,such as WS-Security, WS-Routing, DIME, WS-Attachments, and so on. WSE is installedas a set of .NET assemblies. These are implemented as filters that integrate with ASP.NET webservices. Clients that consume these web services can expand and interrogate the SOAP messageheaders using WSE.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!