Lightweight Web data service framework kingsoc. Web. webcall

Source: Internet
Author: User
Lightweight Web data service framework: kingsoc. Web. webcall 1. Introduction
(1) It is a lightweight and convenient Web Data Service Framework. (2) automatically generate a client JS call script for any page/handler/class on the server (including dynamically compiled classes, such as the CS class in aspx and app_code). (3) provide data in a way similar to WebService URL, for example, handler1.ashx \ gettime (4) returns rich formats (XML, JSON, text, image ), the client can specify the data format returned by the server (5) with the cache mechanism ps. this component can effectively reduce the complexity of the data service-based system. A set of CS code can be used by the server or published to the client for calling, effectively reducing the amount of code and facilitating maintenance. In fact, it is a bit similar to webapi, but it is not deliberately encapsulated into a rest method. This module focuses on method calls. 2. Functions

 

    Method ing
  • View the JS file mapped to the client by the app_code class
  • View JS files mapped to the client by the aspx class
  • View the JS file mapped by the ashx class to the client
  • View the JS file mapped from the aspx file to the client
  • View the JS file mapped from the ashx file to the client
    Method call
  • Call the app_code class method (using JS function calls mapped to the client)
  • Call the app_code class method (use jquery to manually write the call code)
  • Call the aspx Class Method
    Output Format
  • Server return format: Text
  • Server return format: JSON
  • Server return format: Image
  • The client specifies the server method output format: XML
  • The output format of the method specified by the client on the server is JSON.
  • The client specifies the server method output format: imagebase64
3. Use
(1) Add a reference to kingsoc. Web. webcall. dll (2) create any class. Use the [webcall] feature to tag the server code such as using system and using kingsoc. web. webcall; namespace app {public class democlass {[webcall (type = responsedatatype. text, description = "demonstrate custom serialization to HTML"), cacheduration = 30] Public String helloworld (string info) {system. threading. thread. sleep (200); Return "Hello World" + info ;}}( 2) Register httphandler: 
4. Download
Example project: testwebcall

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.