spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column113


JScript .NET, Part VII: Consuming add from ASP.NET

Sr Instructional Designer D2L-Moodle,Clearance
WSI Nationwide, Inc.
US-NJ-Fort Monmouth

Justtechjobs.com Post A Job | Post A Resume
Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs


Consuming the add Web Service

Once you write simpleCalcConsumer.aspx, you can save it in the same directory of the Web service file, simpleCalc.asmx. In our case, the directory is d:\aspDemo. Remember we created a virtual directory in the Web server, Column113, pointing to d:\aspDemo. Load your browser with the following path:

http://localhost/Column113/simpleCalcConsumer.aspx

You should get the following window:

Here is the full code listing of simpleCalcConsumer.aspx:

<%@ Page LANGUAGE="JScript" %>
<%@ import namespace="calcService" %>
<HTML>
<SCRIPT LANGUAGE="JScript" RUNAT="server">

public function Page_Load(sender:Object, E:EventArgs) : void {
  resultControl.Enabled = false;
}

public function Submit_Click(sender:Object, E:EventArgs) : void {
  var result : String;
  var webService : simpleCalc;
  webService = new simpleCalc();

  result = webService.add(int.Parse(first.Text),
    int.Parse(second.Text)).ToString();
  resultControl.Text = result;
}

</SCRIPT>
<HEAD>
  <TITLE>simpleCalc XML Web Service Test</TITLE>
</HEAD>
<BODY STYLE="font-size:12; font-family:arial,verdana,sans-serif;">
  <FORM RUNAT="server">
  <TABLE BORDER="0">
  <TR><TD>Enter First Number:</TD><TD>
  <ASP:TEXTBOX RUNAT="server" SIZE="4" ID="first"
    STYLE="text-align:'right'"/>
  </TD></TR>
  <TR><TD>Enter Second Number:</TD><TD>
  <ASP:TEXTBOX RUNAT="server" SIZE="4" ID="second"
    STYLE="text-align:'right'"/>
  </TD></TR>
  <TR><TD align="right">
  <ASP:BUTTON TEXT="Add" ID="doAdd" OnClick="Submit_Click"
    RUNAT="server"/>
  </TD><TD><HR></TD></TR>
  <TR><TD></TD><TD>
  <ASP:TEXTBOX ID="resultControl" RUNAT="server"
    STYLE="text-align:'right'" SIZE="4"/></TD></TR>
  </TABLE>
  </FORM>
</BODY>
</HTML>


Next: A Final Word

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: June 30, 2002
Revised: June 30, 2002

URL: http://www.webreference.com/js/column113/8.html