A simple Webservice demo (medium) _ frontend page call, webservicedemo
First, create a project. There are two call methods. To facilitate understanding, create a WebserviceTest page, for example:
REFERENCE The Written service first. Here we use the previously written service. See the demo of a simple Webservice written last time to simulate a simple service.
Here we want to create a new service and call it for reference to the service. In general, js cannot access services across domains. Of course, it is only common that cross-domain access is required. The online search method is required. However, it makes no sense to do that. Create a service named MyJsWebservice, for example:
Call the referenced service in the service, and cancel the annotation of the Ajax script call and cancellation. For example:
Generate the following solution, which is now called on the page. Use jQuery and Ajax.
Front-end code:
1
Test successful:
Urgent: how to implement a simple application instance for webservice problems?
You can call webservice in your action.
Web application tips (1) how to call WebService?
On the surface, Web service is an application that exposes an API that can be called through the Web. That is to say, you can use a programming method to call this application through the Web. A more accurate explanation of Web services: Web services is a new platform for building interoperable distributed applications. As a Windows programmer, you may have created a component-based distributed application using COM or DCOM. COM is a very good component technology, but we can easily cite situations where COM does not meet the requirements. The Web service platform is a set of standards that define how applications implement interoperability on the Web. You can use any language you like to write Web Services on any platform you like, as long as we can query and access these services through Web service standards. No matter what tool or language your Web service uses, the overall structure is consistent as long as you use the SOAP protocol to call it over HTTP. Generally, you use your preferred language (such as VB 6 or VB. to build your Web service, and then use the SOAP Toolkit or. NET built-in support to expose it to Web customers. Therefore, customers in any language and platform can read its WSDL document to call this Web service. The customer generates a SOAP request message based on the WSDL description. Web services are placed after Web servers (such as IIS). The SOAP requests generated by the customer are embedded in an http post request and sent to the Web server. The Web server then forwards these requests to the Web service request processor. For the VB 6 program, the Web service request processor is an ASP page or ISAPI extension that works with the SOAP Toolkit component. For VB. NET programs, the Web service request processor is an ISAPI extension that comes with the. NET Framework. The request processor parses the received SOAP request, calls the Web service, and then generates the corresponding SOAP response. After the Web server receives a SOAP response, it will send it back to the client through HTTP response. 2. After SOAPWeb service is created, others will call it. Simple Object Access Protocol (SOAP) provides standard Remote Procedure Call (RPC) Methods to call Web Services. The SOAP specification defines the format of SOAP messages and how to use SOAP over HTTP. SOAP is also based on XML and XSD, and XML is the data encoding method of SOAP. The method call request and result return values between the client and the server are placed in these messages. XML and XSD Extensible Markup Language (XML) are basic formats for data representation on the Web service platform. In addition to ease of establishment and analysis, XML has the primary advantage of being platform-independent and vendor-independent. Independence is more important than technical superiority. XML solves the problem of data representation, but it does not define a set of standard data types, let alone how to extend this set of data types. For example, what is the integer number? 16-bit, 32-bit, or 64-bit? These details are important for implementing interoperability. XML Schema (XSD) developed by W3C is a set of standards dedicated to solving this problem. It defines a set of standard data types and provides a language to extend this data type. The Web service platform uses XSD as its data type system. When a Web service is constructed in a certain language (such as VB. NET or C #), all the data types used must be converted to the XSD type to comply with the Web service standard. Web Services Description Language (WSDL) is used to describe the XML format of the Services provided by the server... the remaining full text>