README.txt examples11/ 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61:

README Computer Science E-259

OVERVIEW In these directories are two client-server pairs, one that demonstrates Project 4’s warehouse and one that demonstrates a tax service. Each’s usage is documented below.

TAXES To access TaxService.jws as a web service, simply do the following. 1.

Spawn Tomcat from within examples11/server/, after specifying in examples11/server/conf/server.xml the ports desired.

2.

Execute the following command (which, unfortunately, wraps onto a second line) from within examples11/clients/taxes/. java org.apache.axis.wsdl.WSDL2Java "http://$ICEBOX.fas.harvard.edu:n/taxes/TaxService.jws?wsdl"

3.

Edit the first line of examples11/clients/taxes/TaxClient.java so that the appropriately named package is imported. The first line of that file, at present, is import edu.harvard.fas.ice1.taxes.TaxService_jws.*; because we whipped up this demo on ice1.fas.harvard.edu.

4.

Execute the following commands from within examples11/clients/taxes/. javac TaxClient.java java TaxClient You should see the result of the service’s performing the various calculations specified in TaxClient.java.

WAREHOUSE To access Project 4’s warehouse as a web service, simply do the following. 1.

Spawn Tomcat from within examples11/server/, after specifying in examples11/server/conf/server.xml the ports desired.

2.

In another terminal, execute the following command (which, unfortunately, wraps onto a second line) from within examples11/clients/warehouse/. java org.apache.axis.wsdl.WSDL2Java

1/2

README.txt examples11/ 62: 63: 64: 3. 65: 66: 67: 68: 69: 70: 71: 72: 73: 4. 74: 75: 76: 77: 78: 79: 80: 81:

"http://$ICEBOX.fas.harvard.edu:n/warehouse/services/Purchasing?wsdl" Edit the first line of examples11/clients/warehouse/PurchasingClient.java so that the appropriately named package is imported. The first line of that file, at present, is import edu.harvard.fas.ice1.warehouse.services.Purchasing.*; because we whipped up this demo on ice1.fas.harvard.edu. Execute the following commands from within examples11/clients/warehouse/. javac PurchasingClient.java java PurchasingClient You should see the result of the service’s application of po-ack.xsl to the empty element passed to the service by PurchasingClient.

2/2

TaxClient.java

1/1

examples11/clients/taxes/ 1: import edu.harvard.fas.ice1.taxes.TaxService_jws.*; 2: import org.apache.axis.AxisFault; 3: 4: 5: /** 6: * Lecture 11’s demo of a client that accesses a web service 7: * that performs various tax calculations. 8: * 9: * Excerpted from 10: * http://www.ammai.com/modules.php?op=modload&name=Sections&file=index&req=viewarticle &artid=4&page=5 11: * 12: * @author Ammai.com 13: * @author Computer Science E-259 14: **/ 15: 16: public class TaxClient 17: { 18: /** 19: * Main driver. 20: */ 21: public static void main(String[] args) 22: { 23: try 24: { 25: // Make a service 26: TaxServiceService service = new TaxServiceServiceLocator(); 27: TaxService port = service.getTaxService(); 28: 29: // Make the actual calls to the three methods 30: double taxpercent = port.calcTaxRate(21.00, 23.10); 31: double total = port.calcTotal(21.00, 0.10); 32: double subtotal = port.calcSubTotal(23.10, 0.10); 33: 34: // Output the results 35: System.out.println( 36: "Subtotal: 21.00, Total: 23.10, Tax: " + taxpercent 37: ); 38: System.out.println( 39: "Subtotal: 21.00, Tax: 0.10, Total: " + total 40: ); 41: System.out.println( 42: "Total: 23.10, Tax: 0.10, Subtotal: " + subtotal 43: ); 44: } 45: catch (AxisFault af) 46: { 47: System.err.println("An Axis Fault occurred: " + af); 48: } 49: catch (Exception e) 50: { 51: System.err.println("Exception caught: " + e); 52: } 53: } 54: }

PurchasingClient.java examples11/clients/warehouse/ 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39:

import edu.harvard.fas.ice1.warehouse.services.Purchasing.*; import org.apache.axis.AxisFault;

/** * Lecture 11’s demo of a client that accesses Project 4’s * warehouse. * * @author Computer Science E-259 **/ public class PurchasingClient { /** * Main driver. */ public static void main(String [] argv) { // attempt to connect to warehouse try { PurchasingService service = new PurchasingServiceLocator(); Purchasing port = service.getPurchasing(); // eh, we’ve got nothing to say tonight System.out.println(port.processPO("")); } catch (AxisFault af) { System.err.println("An Axis Fault occurred: " + af); System.err.println(); System.err.println(af.dumpToString()); } catch (Exception e) { System.err.println("Exception caught: " + e); } } }

1/1

TaxService.jws

1/1

examples11/server/webapps/taxes/ 1: /** 2: * Lecture 11’s demo of a web service that performs 3: * various tax calculations. 4: * 5: * Excerpted from 6: * http://www.ammai.com/modules.php?op=modload&name=Sections&file=index&req=viewarticle &artid=4&page=4. 7: * 8: * @author Ammai.com 9: * @author Computer Science E-259 10: **/ 11: 12: public class TaxService 13: { 14: /** 15: * Determines tax rate based on given subtotal and total. 16: */ 17: public double calcTaxRate(double subtotal, double total) 18: { 19: double rate = (total - subtotal) / subtotal; 20: return rate; 21: } 22: 23: 24: /** 25: * Determines pre-tax subtotal based on given total and 26: * tax rate. 27: */ 28: public double calcSubTotal(double total, double taxpercent) 29: { 30: double subtotal = total / (1 + taxpercent); 31: return subtotal; 32: } 33: 34: 35: /** 36: * Determines total based on given subtotal and 37: * tax rate. 38: */ 39: public double calcTotal(double subtotal, double taxpercent) 40: { 41: double total = subtotal * (1 + taxpercent); 42: return total; 43: } 44: }

README.txt 1/2 - The Open Academy

27: TaxService port = service.getTaxService();. 28: 29: // Make the actual calls to the three methods. 30: double taxpercent = port.calcTaxRate(21.00, 23.10);. 31:.

7KB Sizes 4 Downloads 210 Views

Recommend Documents

README.txt 1/2 - The Open Academy
8: In these directories are two client-server pairs, one that ... http://www.ammai.com/modules.php?op=modload&name=Sections&file=index&req=viewarticle.

Computer Science E-75 - The Open Academy
Computer Science E-75. Building Dynamic Websites. Harvard Extension School http://www.cs75.net/. Lecture 9: Ajax. David J. Malan [email protected] ...

AttributeConverter1.xsl 1/2 - The Open Academy
AttributeConverter1.xsl. 1/2 examples5/. 1: 2:

Computer Science E-75 - The Open Academy
Harvard Extension School http://www.cs75.net/. Lecture 7: JavaScript ... CDATA[. // put cursor in username field if empty ... else put cursor in password field else.

anchor.svg 1/1 - The Open Academy
9: This is CSCI E-259. ...... 4Y,i2c2Td>E+"ZS1D[5Z+XDmn@md9I^'JbRMH"cJ-'e@on .... 44: .

Computer Science E-75 - The Open Academy
9. PHP + JSON. ▫ json_encode($value) http://us3.php.net/manual/en/function.json-encode.php. ▫ eval(string) http://www.json.org/js.html ...

SAXDemo2.java 1/2 - The Open Academy
61: * @param uri namespace. 62: * @param localName name of element, sans namespace. 63: * @param qName name of element, with namespace. 64: * @param attributes element's collection of attributes. 65: *. 66: * @throws SAXException general SAX error or

Computer Science E-1 Spring 2010 Scribe ... - The Open Academy
We'll soon make a tool available via web or e-mail that will allow you ... address bar. http://www.cnn.com:80/ will take us to CNN's homepage as usual. • If you'd ...

Computer Science 75 Fall 2009 Scribe Notes ... - The Open Academy
One disadvan- tage of the JavaScript is that you have no way of logging how users are interacting with your search box because no information is being sent to your server. • Which approach might we want to take if we were developing for a mobile de

The Link - Broadlands Academy
Examinations and Careers Officer. Official ESFA photographs from the National Football ... of information: http://www.nam.ac.uk/ waterloo200/about/. Ms Olsen ...

UPSC recruits National Defence Academy & Naval Academy ...
UPSC recruits National Defence Academy & Naval Academy Examination (II) Advertisement.pdf.pdf. UPSC recruits National Defence Academy & Naval ...

12/04/2015 Open Board Meeting Minutes.pdf
Try one of the apps below to open or edit this item. 12/04/2015 Open Board Meeting Minutes.pdf. 12/04/2015 Open Board Meeting Minutes.pdf. Open. Extract.

Restaurants near the Academy - Groups
East Side [110th to 86th Street]. Sarabeth's [in the Wales Hotel] – American. Paola's [in the Wales Hotel] - Italian. Table d' Horte – French. Le Paris Bistrot ...

Oct 12 Open House Boards v6_ForSurvey.pdf
DEEP BAY. DUNSMUIR. PROPOSED NETWORK. IMPROVEMENTS. BACKGROUND. Area H Boundary. Existing Trails. Roads. Rail Corridor. Water Bodies.

2014-12-09 BAC Open House Presentation.pdf
Try one of the apps below to open or edit this item. 2014-12-09 BAC Open House Presentation.pdf. 2014-12-09 BAC Open House Presentation.pdf. Open.

05 May 12 CASEE 25th anniversary open house.pdf
Page 1 of 1. CASEE 25 Year. Anniversary. Open House. 1:00: Tours and Displays. 2:00: Program. 3:00: Light refreshments and Tours. Open to past and present students, parents,. supporters and the public. 11104 NE, 149th St. Brush Prairie, WA. 360.885.5

Academy for
AIMS-UK Islamic Banking & Finance | Online Certifications | Training & Consultancy. 1. INTRODUCTION TO TAKAFUL. A. Meaning of Takaful. ▫ Takaful comes ...

The Prevention Press - North Star Academy
Rocky Heights Middle School. Mountain Vista High School. Rock Canyon High School. ThunderRidge High School. Castle View High School. DC Oakes.