|
1
|
- 6.916 Lecture
- Thursday, October 19, 2000
- Jim Miller (Microsoft)
|
|
2
|
- Design HTML
- Decide where it’s not static
- Write code to parse incoming URL
- Write code to generate HTML page
- If you need state, use a data base
- If you need session state ...
- … use a cookie (client side)?
- … encode in URL?
- … store in data base, use URL (server side)
|
|
3
|
|
|
4
|
- Service Side
- Write the service code
- Define the externally visible methods
- Create the WSDL description of those methods
- Publish the WSDL
- Run the service
- Client Side
- Locate the WSDL
- Load the WSDL
- Convert to a client proxy
- Write the client code, calling proxy
|
|
5
|
- Use the Web – someone ought to build a portal
- Ask a Server – someone ought to standardize a “request for service
description”
- Provide a “well-known Web Service”
- “Portal for programs, not people”
- Categorize services
- Who decides the categories
- Can a service be in multiple categories?
- What about business arrangements?
- Take a look at http://uddi.org
|
|
6
|
- Use a browser
- “just” HTML
- client-side scripts
- download “controls”
- Write a custom application
- Use HTTP to connect
- Use HTML, XML, SOAP, etc. as payload
- Communicate via “side channel” to other sources
|
|
7
|
- Why not separate HTML from code?
- Why not program in your favorite language, or languages?
- Why not have rich, programmable tags?
- Why write the WSDL at all?
- Why not program with objects instead of SOAP strings?
- What about multiple clients?
- Isn’t it a pain to write separate code for each kind?
- But doesn’t it look ugly and run slow if you don’t?
- …and what about “odd” devices like cell phones
|
|
8
|
- You all know how to do this -- http://localhost/jsm.aspx
- Let’s see how it looks in ASP.NET …
- It would look the same even for a cell phone
- I didn’t write any state maintenance code
- From my point of view, there are just objects with state
- Behind the scenes, of course, it’s the same old stuff…
- I’ve combined the HTML and script code, but that’s not necessary and
isn’t a good idea for large Web sites
|
|
9
|
- <html>
- <body>
- <center>
- <form
method="post" runat="server">
- Type your first and last
name:
- <asp:textbox
id="Name" runat="server"/>
- <asp:button
type=submit text="Hello"
-
OnClick="SubmitBtn_Click“
-
runat="server"/>
- <BR> <asp:label
id="FirstName"
-
runat="server"/>
- <BR> <asp:label
id="LastName" runat="server"/>
- <p>
- </form>
- </center>
- </body>
- ... See next slide
|
|
10
|
- <script
language="C#" runat=server>
- void SubmitBtn_Click(Object
sender, EventArgs e)
- { String[] Parts =
- Name.Text.Split(new char []
{' '});
- FirstName.Text = "First
name: " + Parts[0];
- LastName.Text = "Last
name: ";
- for (int i=1; i <
Parts.Length; i++)
- LastName.Text += Parts[i];
- }
- </script>
- </html>
|
|
11
|
- ASP.NET is a Web server, the successor to ASP
- Basic model is static pages
- Instructions to the server are embedded in HTML
- <asp: … runat=server> indicates a “server-side control”
- Tests for client, generates either HTML or DHTML or WAP or …
- Programmable in two ways
- Via the HTML
- Via programs in any number of languages, appearing as objects (with
fields, methods, state, and attributes)
- While Microsoft ships a large number of these “server controls”
- All the APIs to do it are public
- We ship several source code samples
- We want to start a market for third party controls
|
|
12
|
- <asp:label id="FirstName" runat="server"/>
- FirstName.Text = "First name: " + Parts[0];
|
|
13
|
- We don’t want to restrict the choice of language
- We don’t want to restrict the operations available on the embedded
controls
- We want a rich set of operations with default behavior
- ASP.Net defines
- An object model for Web pages
- An object model for Web controls
- An object model for plugging in languages
- Underneath, there’s a Common Language Runtime
|
|
14
|
|
|
15
|
|
|
16
|
- Key to simpler programming model
- Generated automatically
- Stored with code in executable file
(.dll or .exe)
- Uses existing COFF format
- Via existing extension mechanism
- Stored in binary format
- Convertible to/from XML Schema
- Convertible to/from COM type libraries
|
|
17
|
- Description of deployment unit (assembly)
- Identity: name, version,
culture[, public key]
- What types are exported
- What other assemblies it depends on
- Security permissions needed to run
- Description of types
- Name, visibility, base class, interfaces implemented
- Members (methods, fields, properties, events, nested types)
- Custom attributes
- User-defined
- Compiler-defined
- Framework-defined
|
|
18
|
|
|
19
|
|
|
20
|
- “Econo” JIT
- Generates unoptimized native code
- Code can be discarded and regenerated
- “Standard” JIT
- Generates optimized native code
- Includes verification of IL code
- Install time code generation
- Done at install time
- Reduces start-up time
- Native code has version checks and reverts
to runtime JIT if they fail
|
|
21
|
- Managed code provides...
- Metadata describing data
- Location of references to objects
- Exception handling tables
- So runtime can provide…
- Exception handling
- Security
- Automatic lifetime management
- Debugging and profiling
|
|
22
|
- Layout Provided by Runtime
- Usually automatic
- Metadata can specify
- Order
- Packing
- Explicit layout
- Lifetime Managed by Runtime (GC)
- Working set is compacted
- Data is moved
- Object references are updated
- No more intrusive than a page fault
|
|
23
|
|
|
24
|
- Mode transition for code manager
- Calling conventions differ on x86
- Fast, rarely more than register shuffle
- Data type marshalling
- Representations may not be the same
- Pinning, copying, and/or reformatting needed
- Custom marshalling supported
- The IL to native compilers help
- In-line code transition and simple marshalling
- Per call site cost is very low
- Plus a small cost on entry to a procedure that can make calls across
boundary
|
|
25
|
- When ASP.Net notices a new page, it calls the appropriate compiler to
generate IL and metadata
- The IL is compiled to native code
- The native code runs
- In addition to the regular URL there is a query form used to retrieve
the WSDL
- When the WSDL is requested the metadata is converted to WSDL, cached,
and returned
- There are tools that convert WSDL into proxy programs so clients can
access the service
- When SOAP is sent to the service, it is converted to objects as
described in the WSDL and passed to the service code
|