spacer

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

home / experts / javascript / column114


JScript .NET, Part VIII: Consuming IsPrime from ASP.NET

Market Data Analyst (IL)
Next Step Systems
US-IL-Chicago

Justtechjobs.com Post A Job | Post A Resume
Developer News
OpenOffice 3.2 Lands Amid Critical Changes
Red Hat, IBM Firmly in KVM Virtualization Camp
Red Hat Talks Up Open Source Cloud Plans


Consuming the IsPrime Web Service

Once you write isPrimeConsumer.aspx, you can save it in the same directory of the Web service file, checkIsPrime.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/isPrimeConsumer.aspx

You should get the following window:

Here is the full code listing of isPrimeConsumer.aspx:

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

public function Submit_Click(sender:Object, E:EventArgs) : void {
  var result : String;
  var webService : PrimeNumbers;
  webService = new PrimeNumbers();
  
  result = webService.IsPrime(int.Parse(first.Text));
  resultControl.Text = (result == 0 ? " is not a prime number": "   is a prime number") ;
}

</SCRIPT>
<HEAD>
  <TITLE>IsPrime 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 ALIGN="middle"><ASP:TEXTBOX ID="first" RUNAT="server" SIZE="4" STYLE="text-align:'right'"/></TD>
	    <TD ALIGN="middle"><ASP:LABEL ID="resultControl" RUNAT="server"/></TD>
	  </TR>
	  <TR>
	    <TD><ASP:BUTTON TEXT="Is Prime?" ID="isprime" OnClick="Submit_Click" RUNAT="server"/></TD>
	  </TR>
    </TABLE>
  </FORM>
</BODY>
</HTML>


Next: A Final Word


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

webref The latest from WebReference.com Browse >
Search Engine Optimization: Selecting and Embedding Keywords · Are Google's Language Translation Web Services Ready for Prime Time? · Installing and Using Meeplace, the Business Review CMS
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
IBM DB2 10 for z/OS: Justifying the Upgrade · Living La Vida Colo: Choosing the Right Colocation Facility · FTC Concerns over Social Media Privacy Linger


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

URL: http://www.webreference.com/js/column114/6.html