Legal Information |
|
A real-estate example mght need to communication with a third party to work at all. Assume that the "Acme Credit Rating Agency" is on the cutting edge of technology, and exposes its business data via software as a service. Remember, you are a realtor developing a website that potentially includes information from various banks. Here is the .NET code (written in C#) that your web-developer will need to write to retrieve status data from Acme.
Example 1: Web-Service Client//Create a new objectThis example assumes that the Acme Agency exposes a web-service method called GetStatus that takes a last name and first name as arguments. What it returns is a tring describing the credit status. Your web developer could display this string as web UI to the user, or use it in any way they like.
AcmeCreditService agency = AcmeCreditService();
//Call a method or function on the object
String status = credit.GetStatus("Clark", "Jason");
So as you can see, something as complex as network communication with a third-party has been boiled down to a simple object creation and method or function call. But where does the AcmeCreditService object come from?. It is automatically generated.
A tool, included with the frameworks, performs the work of interpreting a standard web-service description language called WSDL, to create the AcmeCreditService object. WSDL is an open standard that the .NET Frameworks just understands. The WSDL data itself was created by Acme, so the web developer had to do very little to make this code work!
The .NET Frameworks makes very clever use of general-purpose standards like SOAP, XML, and WSDL to make advanced functionality simple. It is worth noting that none of these standards have anything to do with the Real-Estate industry, and yet they can be used to transmit Real-Estate information (as well as any other kind of digital data) easily.
What if Acme's competitor, the Foo Credit Agency, wrote their web-service with an entirely different interface?. Ideally, two credit frefernece agencies will choose similar or identical interfaces to expose similar data. But if they don't (and you can bet that often they won't), it is simple for your developers to adjust your company's web code appropriately.
Let's assume that the Foo Agency's web service interface takes an "agency ID" and returns a status code.
Example 2: Another Web-Service Client
//Create a new objectIn this case, perhaps the Foo Escrow Company provides more advanced "status" information in a special type defined by the WSDL for their web-service. Either way, the .NET Frameworks tools and CLR work together to make your developers job a snap. Bottom line is this code, and the previous example code take nearly no time to write and can co-exist happily in your web site.
FooCreditService agency = FooEscrowService();
//Call a method or function on the object
FooCreditStatus status = agency.GetStatus("JCLA777-12-7777");
So what if you are the Acme Credit Agency and you are writing a web-service? The .NET Frameworks exposes this functionality as objects, which makes the programmers job a whole lot more fun. Example 3 û A Web-Service
class AgencyService : WebService {In this example, by deriving a new class called AgencyService from the WebService class, which is (of course) part of the Frameworks Class Library, your developer has created a completely functional web-service.
[WebMethod]
public String GetStatus(string lastName, string firstName) {
String status;
// use ADO.NET or some other data access
// to access data about the requested user
return (status);
}
}
The general idea is that services on the Internet should be as easy to access as traditional hardware peripherals. So it should be as easy to develop code that dynamically retrieves data from a remote source on the Internet, as it is to write code that displays a window on the computer's screen or reads keyboard input. From the programmer's point of view, this is all just business-logic where the software is taking advantage of a "service" offered by a third party.
Search Knowledge Base | Feedback |