Client Agent Analysis

Source: Internet
Author: User
Client Agent Analysis
• Each Service class corresponds to a proxy class on the client.
• Each proxy class is a subclass of the SYS. net. webserviceproxy class.
• Each method of the proxy class corresponds to a static method of the class
• Finally, the request is sent by the SYS. net. webserviceproxy. Invoke method.

Aspx < Form ID = " Form1 " Runat = " Server " >
< ASP: scriptmanager ID = " Scriptmanager1 " Runat = " Server " Scriptmode = " Debug "   />

< Input type = " Button " Value = " Get range random " Onclick = " Getrandom (1, 50,100) "   />

< Script Language = " Javascript " Type = " Text/JavaScript " >
Function getrandom (minvalue, maxvalue)
{
SYS. net. webserviceproxy. Invoke (
" Services/usehttpgetservice. asmx " ,
" Getrangerandom " ,
True ,
{ " Minvalue " : Minvalue,
" Maxvalue " : Maxvalue },
Onsucceeded,
Null ,
Null ,
- 1 );
}

Function onsucceeded (result)
{
Alert (result );
}
</ Script >
</ Form >

The inlinescript = "true" of scriptmanager is not called by using the SYS. net. webserviceproxy. Invoke method instead of the client proxy.

usehttpgetservice. asmx <% @ WebService language = " C # " class = " usehttpgetservice " %>

UsingSystem;
UsingSystem. Web;
UsingSystem. Web. Services;
UsingSystem. Web. Services. Protocols;
UsingSystem. Web. Script. Services;

[WebService (namespace =   " Http://tempuri.org/ " )]
[Webservicebinding (conformsto = Wsiprofiles. basicprofile1_1)]
[Scriptservice]
Public   Class Usehttpgetservice: system. Web. Services. WebService
{
[Webmethod]
Public   Int Getrandom ()
{
Return   New random (datetime. Now. millisecond). Next ();
}

[Webmethod]
[Scriptmethod (usehttpget=True)]
Public IntGetrangerandom (IntMinvalue,IntMaxvalue)
{
Return NewRandom (datetime. Now. millisecond). Next (minvalue, maxvalue );
}
}

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.