:: Quotive ASP.NET (5) ::

zhaozj2021-02-08  218

Detuction ASP.NET (5) Green Apple Studio (Compilation) 01-5-23 10:47:59

Develop Web Services (Web Services)

Software published on the Internet is the core of Web Services. ASP.NET provides a Web Services's basic constructor that enables developers to create services for this service model.

Now let's track a simple example. For example, you have to buy books from a online bookmaker, and they have a tracking system that enables you to see your own order. Book merchants use a land transport company to transport your book. This transport company also has a tracking system. This way, in order to get the exact state of your order, you have to view two sites. It is convenient if the book makers can display its own order status and transport company's status information.

Web Services allows you to expose customer communities to the public on the Web, such as parcel tracking details. Write an object, exposing its method as a URI, and the URI returns an XML data. Sketch now can call the transport company's tracking service and incorporate the results of the track into its own order trace application. The following is how to create a service code with C #:

<% @ Webservice Language = "C #"%>

Using system.Web.services;

PUBLIC CLASS shipping {

[WebMethod]

Public string ORDERSTATUS (String ORDERNUMBER) {

// Code Here to Retrieve Order Details from Data Store

Return status;

}

}

The above code is saved in the tracking.asmx file, located in the application directory of the transport company Web site. Such bookmakers can use a variety of ways to call this Web Services. For example, using http-get, the parameter is passed with the query string:

http://orders.ups.com/orders/tracking.asmx/Orderstatus?orderNumber=bru123

Scribesels can also use HTTP-POST, the parameters of the method are passed in the POST body. Or you can also use the HTTP-SOAP, the parameters of the method are wrapped in an industrial standard XML format.

Now the user only needs to query their order details in the book merchant, and the brothers' web application will collect tracking information from the transport company, and then return to the status of the book. Scribesels can also expose its order status detail as a web service, so that others use it.

The greatness of Web Services is that it allows you to expose a service without exposing data or all business rules. Codes and data are safe while automatic providing business services. In the next few years, as the B2B program is available, the market of Web Services will grow rapidly.

转载请注明原文地址:https://www.9cbs.com/read-3260.html

New Post(0)