Web Services | |
Frameworks and Libraries: ASP.NET, ADO.NET, Window Forms |
|
Interchange standards: SOAP, WSDL, UDDI |
Common Development Tools: Visual Studio .NET |
Component Model | |
Object Model and Common Language specification | |
Common Language Runtime |
<%@ WebService Language="C#" Class="ProgWS.HelloWorldService" %> using System.Web.Services; namespace ProgWS { public class HelloWorldService: WebService { [WebMethod] public string HelloWorld() { return "Hello World"; } } }
WebMethod
can have
Description
: a text description.MessageName
: the name of the SOAP
message. EnableSession
: HTTP sessions. CacheDuration
: how long to cache
request/response pair. TransactionOption
: is it a database
transaction? (atomic, can be rolled back) DNSLookupService
) is added
automatically, so you can then use it: using System; namespace DNSConsumerApp { class Consumer { static void Main(String[] args) { localhost.DNSLookupService objDNS= new localhost.DNSLookupService(); string strIPAddress = ""; strIPAddress = objDNS.getIPForHostnae(args[0]); Console.WriteLine("Hostname: " + args[0] + " IP: " + strIPAddress); } } }
class proxy { ... public System.IAsyncResult BeginDelay(System.AsyncCallback callback, object asyncState){ return this.BeginInvoke("Delay", new object[0], callback, asyncState); } public int EndDelay(System.IAsyncResult asyncResult){ object[] results = this.EndInvoke(asyncResult); return((int)(results[0])); } }
BeginDelay
. It returns an
object that allows us to check if the request has been done.This talk available at http://jmvidal.cse.sc.edu/talks/dotnetoverview/
Copyright © 2009 José M. Vidal
.
All rights reserved.
13 April 2004, 03:12PM