ASP.NET and Web Services, Part 1 - SOAP's Messaging Architecture
(Page 7 of 9 )
Let's step through Listing 1. The header indicates this is an HTTP POST request, followed by the name of the method, MathWebService. The .asmx extension is used for files that implement XML web services.Web services can be accessed directly through .asmx files, or this file can redirect the request to a compiled assembly implementing the web service. The root element of the SelectMaxValue document is the Envelope element. The listing has two sub-elements, the body and header elements.
The next item of interest is the attribute bearing the name of the host machine. The Content-type specifies the file as text/xml, and the encoding is utf-8. The SOAPAction attribute identifies the URI namespace where the method is located and lists the web service name. The XML declaration indicates the SOAP message is XML-based. Next, all SOAP messages have an envelope, where the message body is embedded. Both client and recipient must strip the content from the envelope for further processing. Notice the default xmlns namespace declarations. These must precede the SOAP body. Finally, the method is processed where the web service determines whether int value x is greater or smaller than y. The response is virtually self-explanatory. Beginning with the traditional SOAP header, the SOAP body result syntax is similar to the request, with the exception that the Method syntax indicates it is a response and returns a result.Before the discussion focuses on other SOAP attributes, here are the key elements discussed so far:
- The SOAP envelope This encodes header information about the message and body of the message.
- SOAP encoding This allows for a standardized method of serializing data into the body of a SOAP message.
- RPC-style messages This entails the type of protocol a developer can employ to facilitate procedure-oriented communications via a request-response message.
- HTTP binding This is the industry-wide method of binding SOAP messages to the HTTP messaging protocol.
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: Other SOAP Attributes >>
More ASP.NET Articles
More By McGraw-Hill/Osborne