ASP.NET and Web Services, Part 1 - Primary Web Services Technologies
(Page 6 of 9 )
The preceding discussion has focused on describing a web service process. It is useful now to explain how the client accesses services by employing the core web technologies-namely, Simple Object Access Protocol (SOAP), HTTP,Web Services Description Language (WSDL), and Universal Description, Discovery, and Integration
(UDDI)-to locate the service/services the client specifies. Developers can browse numerous web service repositories (registries) and select appropriate services for implementing their own applications. Figure 2 demonstrates how a registry serves as host to a collection of web services.
Simple Object Access Protocol
SOAP provides a standard structure for transmitting XML documents over the wire, which includes SMTP, HTTP, and FTP. SOAP also defines encoding and binding standards for encoding non-XML Remote Procedure Calls. SOAP enhances interoperability between client and server. Clients with .NET can call EJBs through SOAP and vice versa.
NOTE Other protocols have been developed, for example, Sun's RPC, Microsoft's DCE, Java's RMI, and CORBA's ORBC.

Figure 2 A web service registry
Why are so many corporations embracing SOAP? It has industry-wide support and is not bound to one programming language. Interestingly, SOAP does not use a specified set of APIs, but rather leaves the implementation up to the programming language (such as Java) and the platform (such as Microsoft .NET). The SOAP specification does not describe how SOAP messages should be bound to HTTP.SOAP is an XML document. Listing 1 is representative of a typical SOAP request and response XML file.
Listing 1 SOAP request-response example
POST
/MathWebService/Service1.asmx HTTP/1.1
Host: ecom10
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/SelectMaxValue"
<?xml version="1.0" encoding="utf-8"? >
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<SelectMaxValue xmlns="http://tempuri.org/">
<x>int</x>
<y>int</y>
</SelectMaxValue>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"? >
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<SelectMaxValueResponse xmlns="http://tempura.org/">
<SelectMaxValueResult>int</SelectMaxValueResult>
</SelectMaxValueResponse>
</soap:Body>
</soap:Envelope>
NOTE In a production environment, change the XML namespace to your own namespace as demonstrated here:
<int xmlns="http://www.dp.org/results/>
Remember: This is part one of chapter 7 .NET & J2EE Interoperability, by Dwight Peltzer (McGraw-Hill/Osborne, ISBN 0-07-223054-1, 2004). If you like what you see, feel free to click on the following link to get your own copy! Buy this book now.
|
Next: SOAP's Messaging Architecture >>
More ASP.NET Articles
More By McGraw-Hill/Osborne