In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how ASP.NET constructs XML Web services". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to construct XML Web services by ASP.NET".
It is relatively easy to build a simple XML Web service using ASP.NET, but the true power of XML Web services will not be understood until you have studied the infrastructure. XML Web services are based on the .NET Framework and the common language runtime. A XML Web service can take advantage of these technologies. For example, the performance, state management, and validation supported by ASP.NET can all be used to construct XML Web services.
The infrastructure of XML Web services is built to comply with industry standards such as SOAP, XML, and WSDL, and it allows clients from other platforms to interoperate with XML Web services. As long as a client can send a standard SOAP message based on a formatted service description, the client can invoke a XML Web service created using ASP.NET (regardless of the platform on which the client exists).
When you use ASP.NET to construct a XML Web service, it automatically supports clients to communicate using SOAP, HTTP-GET and HTTP-POST protocols. Even if HTTP-GET and HTTP-POST support the use of URL-encoded variable name / variable value pairs to deliver messages, the data types that support these two protocols are not as rich as those that support the SOAP protocol. In SOAP, using XML to transfer data to or retrieve messages from a XML Web service, you can define complex data types using XSD schemas that support a rich set of data types. Developers who use ASP.NET to build a XML Web service do not have to explicitly define complex data types. They can construct only one management class. ASP.NET handles mapping classes defined to an XSD schema and mapping object instances to XML data for transmission over the network.
It is important to note that XML Web services do not replace DCOM, and we should say that XML Web services are a messaging infrastructure that communicates across platforms that use industry standards.
Because ASP.NET provides the infrastructure to work internally for XML Web services, developers can focus on implementing the functionality of their specific XML Web services. Developing a XML Web service using ASP.NET starts with the following three steps:
1. Create a file with the .asmx extension.
two。 In this file, a directive is used to declare the XML Web service.
3. Define the XML Web service methods that make up the XML Web service functionality.
XML Web Services is a powerful technology for providing services that can be made accessible over the Internet. The following suggestions will help you create efficient XML Web services:
XML Web services support communication between synchronous and asynchronous clients and servers hosting XML Web services. In the case of synchronous communication, the client sends a request for the service to the service host server to wait for a response. This prevents the client from performing other operations while waiting for the result. However, asynchronous communication causes the client to continue to process other tasks while waiting for it. The client responds to the result of the service request when available.
When you use the Web Services description language tool (Wsdl.exe) to create your proxy class, it produces standard, synchronous, and asynchronous versions of the methods in the class. The asynchronous version consists of two methods, called Begin and End. The Begin method is used to initialize the XML Web service, while the End method gets the result.
Using asynchronous communication can improve system utilization and avoid client delays while it waits for XML Web service results.
The following code example shows how to generate one from a client application to a XML Web service
VoidEnterBtn_Click (ObjectSrc,EventArgsE) {MyMath.Mathmath=newMyMath.Math (); / / CalltoAddXMLWebservicemethodasynchronously / / andthenwaitforittocomplete. IAsyncResultresult= math.BeginAdd (Convert.ToInt32 (Num1.Text), Convert.ToInt32 (Num2.Text), null, null); / / Waitforasynchronouscalltocomplete. Result.AsyncWaitHandle.WaitOne (); / / CompletetheasynchronouscalltoAddXMLWebservicemethod. Floattotal=math.EndAdd (result); / / DisplayresultsinaLabelcontrol. Total.Text= "Total:" + total.ToString ();} Enterthetwonumbersyouwanttoaddandthenpress theTotalbutton.
Number1: + Number2: =
[VisualBasic] SubEnterBtn_Click (SrcAsObject,EAsEventArgs) DimmathAsNewMyMath.Math () 'CalltoAddXMLWebservicemethodasynchronously' andthenwaitforittocomplete. DimresultAsIAsyncResult=_ math.BeginAdd (Convert.ToInt32 (Num1.Text), _ Convert.ToInt32 (Num2.Text), _ Nothing,_ Nothing) 'Waitforasynchronouscalltocomplete. Result.AsyncWaitHandle.WaitOne ()' CompletetheasynchronouscalltoAddXMLWebservicemethod. DimaddtotalAsSingle=math.EndAdd (result) 'DisplayresultsinaLabelcontrol. Total.Text= "Total:" & addtotal.ToString () EndSub Enterthetwonumbersyouwanttoaddandthenpress theTotalbutton.
Number1: + Number2: =
At this point, I believe you have a deeper understanding of "how ASP.NET constructs XML Web services". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.