Spell Checker web service (you build a web client that interacts with the service) The client uses a servlet class and a JSP page. The user passes information.

Slides:



Advertisements
Similar presentations
WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Advertisements

Learning the Basics – Lesson 1
Once the program is opened make sure the “Current Personality” is WebCT 6/ Vista 4 next click on “Import Questions” now you are ready to import your exams.
Servlets and a little bit of Web Services Russell Beale.
1 of 6 Parts of Your Notebook Below is a graphic overview of the different parts of a OneNote 2007 notebook. Microsoft ® OneNote ® 2007 notebooks are digital.
1 of 6 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
Creating And Maintaining A Database. 2 Learn the guidelines for designing databases When designing a database, first try to think of all the fields of.
Using Visual C++ and Pelles C
Create a New Application and Project Open the Create Application dialog. Enter the application name of your choice and the directory. Select No Template.
Figure 1. Hit analysis in 2002 of database-driven web applications Hits by Category in 2002 N = 73,873 Results Reporting 27% GME 26% Research 20% Bed Availability.
Creating Web Page Forms
Printing and Page Formatting ITSW 1401, Intro to Word Processing Instructor: Glenda H. Easter.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
Working with Drivers and Printers Lesson 6. Skills Matrix Technology SkillObjective DomainObjective # Understanding Drivers and Devices Install and configure.
JSP and Servlets Lecture notes by Theodoros Anagnostopoulos.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. M I C R O S O F T ® Preparing for Electronic Distribution Lesson 14.
Chapter 4 Code Editor Goals and Objectives Program more efficiently? How can you speed up your development process? Do you want to learn useful shortcuts.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
Lesson 13: Building Web Forms Introduction to Adobe Dreamweaver CS6 Adobe Certified Associate: Web Communication using Adobe Dreamweaver CS6.
 Understanding an activity  Starting an activity  Passing information between activities  Understanding intents  Understanding the activity lifecycle.
Copyright © Texas Education Agency, All rights reserved. 1 Web Technologies Website Development with Dreamweaver.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
© 2011 Delmar, Cengage Learning Chapter 9 Collecting Data with Forms.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
1 Guide to Novell NetWare 6.0 Network Administration Chapter 11.
XHTML Introductory1 Forms Chapter 7. XHTML Introductory2 Objectives In this chapter, you will: Study elements Learn about input fields Use the element.
Web Technologies Website Development Trade & Industrial Education
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
Microsoft Office 2003 Illustrated Brief Document Creating a.
PMS /134/182 HEX 0886B6 PMS /39/80 HEX 5E2750 PMS /168/180 HEX 00A8B4 PMS /190/40 HEX 66CC33 By Adrian Gardener Date 9 July 2012.
Creating a Web Site to Gather Data and Conduct Research.
Dreamweaver – Dreamweaver Extras Web Design Section 8-4 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development.
 The BPEL Module project is a group of source files which includes BPEL files, WSDL files, and XML schema files. Within a BPEL Module project, you can.
Java Server Pages A JSP page is a text-based document that contains two types of text: static template data, which can be expressed in any text-based format,
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 6 1 Microsoft Office FrontPage 2003 Tutorial 6 – Publishing a Web Site.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
Forms and Server Side Includes. What are Forms? Forms are used to get user input We’ve all used them before. For example, ever had to sign up for courses.
Dreamweaver MX. 2 Overview of Templates n Forms enable you to collect data from ______. n A form contains ________ such as text fields, radio buttons,
Microsoft Access 2010 Chapter 10 Administering a Database System.
Java server pages. A JSP file basically contains HTML, but with embedded JSP tags with snippets of Java code inside them. A JSP file basically contains.
1 HTML Forms
Liferay Installation Prepared by: Do Xuan Hai 8 August 2011.
FrontPage Tutorial Part 2 Creating a Course Web Site.
A seminar on j2ee by saritha. s. What is J2EE J2EE (Java 2 Platform, Enterprise Edition) is a Java platform designed for the mainframe-scale computing.
Evaluating & Maintaining a Site Domain 6. Conduct Technical Tests Dreamweaver provides many tools to assist in finalizing and testing your website for.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 7 1 Microsoft Office FrontPage 2003 Tutorial 8 – Integrating a Database with a FrontPage.
Page Designer Storyboard J. A. Fitzpatrick December 2004.
Dreamweaver MX. 2 Tools for Code Editing (p. 366) n An HTML editor like Dreamweaver writes most of the code you need, but at times you will need to perform.
IT533 Lectures ASP.NET AJAX.
Video in Macromedia Flash (Optional) – Lesson 121 Video in Macromedia Flash (Optional) Lesson 12.
Introducing Dreamweaver. Dreamweaver The web development application used to create web pages Part of the Adobe creative suite.
Creating and Editing a Web Page
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
1 HTML forms (cont.)
Word and the Writing Process. To create a document 1.On the Start menu, point to Programs, and then click Microsoft Word. A new document opens in Normal.
Integrating Components and Dynamic Text Boxes with the Animated Map– Lesson 101 Integrating Components and Dynamic Text Boxes with the Animated Map Lesson.
Ashima Wadhwa Java Script And Forms. Introduction Forms: –One of the most common Web page elements used with JavaScript –Typical forms you may encounter.
© Ms. Masihi.  A Web page contains text and images that convey specific information to viewers.  To create a new web page, open Dreamweaver and select.
2440: 141 Web Site Administration Web Forms Instructor: Joseph Nattey.
Chapter 5 Validating Form Data with JavaScript
Writing simple Java Web Services using Eclipse
Learning the Basics – Lesson 1
Using Procedures and Exception Handling
Presentation transcript:

Spell Checker web service (you build a web client that interacts with the service) The client uses a servlet class and a JSP page. The user passes information to the servlet from the JSP page Fuente:

Creating the Client 1.Choose File > New Project. Under Categories, choose Java Web. Under Projects, choose Web Application. Click Next. Name the project SpellCheckService and make sure that you specify an appropriate server as your target server. Leave all other options at default and click Finish. 2.In the Projects window, right-click the SpellCheckService project node and choose New > Web Service Client. Click Next. 3.Select WSDL URL and specify the following URL for the web service: 4.If you are behind a firewall, you might need to specify a proxy server—otherwise the WSDL file cannot be downloaded. To specify the proxy server, click Set Proxy in the wizard. The IDE's Options window opens, where you can set the proxy universally for the IDE. 5.Leave the package name blank. By default the client class package name is taken from the WSDL. In this case is com.cdyne.ws. Click Finish.

In the Projects window, within the Web Service References node, you see the following: The Projects window shows that a web service called 'check' has made a number of 'CheckTextBody' and 'CheckTextBodyV2' operations available to your application. These operations check a string for spelling errors and returns data to be processed by the client. The V2 version of the service does not require authentication.

Within the Generated Sources node, you see the client stubs that were generated by the JAX-WS Web Service Client wizard.

Expand the WEB-INF node and the wsdl subnode. You find a local copy of the WSDL file, named check.asmx.wsdl.

The URL of the WSDL that you used to create the client is mapped to the local copy of the WSDL in jax-ws-catalog.xml. Mapping to a local copy has several advantages. The remote copy of the WSDL does not have to be available for the client to run. The client is faster, because it does not need to parse a remote WSDL file.

There are many ways to implement a web service client. The web service's WSDL file restricts the type of information that you can send to the web service, and it restricts the type of information you receive in return. However, the WSDL file lays no restrictions on how you pass the information it needs, nor on what the user interface consists of. The client implementation you build below consists of a JSP page which allows the user to enter text to be checked and a servlet which passes the text to the web service and then produces a report containing the result. Developing the Client

1.In the Projects window, expand the Web Pages node of the SpellCheckService project and double-click index.jsp so that it opens in the Source Editor. 2.Copy the following code and paste it over the tags in index.jsp: Digite el texto a revisar: The previously listed code specifies that when the submit button is clicked, the content of the textarea is posted to a servlet called SpellCheckServlet. Coding the JSP Page Our JSP page will consist of a text area, where the user will enter text, and a button for sending the text to the web service.

Creating and Coding the Servlet You only need to deal with the business logic, that is, the preparation of the text to be sent and the processing of the result. 1.Right-click the SpellCheckService project node in the Projects window, choose New > Servlet. Click Next. 2.Name the servlet SpellCheckServlet and type clientservlet in the Package drop-down. Click Next.

In the Configure Servlet Deployment panel, note that the URL mapping for this servlet is /SpellCheckServlet. Accept the defaults and click Finish. The servlet opens in the Source Editor.

4.Put your cursor inside the Source Editor, inside the processRequest method body of SpellCheckServlet.java, and add some new lines right at the top of the method. 5.Right-click in the space that you created in the previous step, and choose Insert Code > Call Web Service Operation. Click the checkSoap.CheckTextBodyV2 operation in the "Select Operation to Invoke" dialog box, as shown below: Click OK Note: You can also drag and drop the operation node directly from the Projects window into the editor, instead of calling up the dialog shown above.

At the end of the SpellCheckServlet class, you see a private method for calling the SpellCheckerV2 service and returning a com.cdyne.ws.DocumentSummary object. private DocumentSummary checkTextBodyV2(java.lang.String bodyText) { com.cdyne.ws.CheckSoap port = service.getCheckSoap(); return port.checkTextBodyV2(bodyText); } This method is all you need to invoke the operation on the web service. In addition, the following lines of code (in bold) are declared at the top of the class: public class SpellCheckServlet extends HttpServlet = " private Check service;

try { String TextArea1 = request.getParameter("TextArea1"); java.lang.String texto = TextArea1; com.cdyne.ws.DocumentSummary doc = checkTextBodyV2(texto); String allcontent = doc.getBody(); int no_of_mistakes = doc.getMisspelledWordCount(); List allwrongwords = doc.getMisspelledWord(); out.println(" "); out.println(" Reporte de Verificacion Sintactica "); out.println(" "); out.println(" Informe de Verificacion "); out.println(" Your text: \"" + allcontent + "\"" + " "); Replace the try block of the processRequest() method with the code that follows. The in-line comments throughout the code below explain the purpose of each line.

for (int i = 0; i < allwrongwords.size(); i++) { String onewrongword = ((Words) allwrongwords.get(i)).getWord(); int onewordsuggestioncount = ((Words) allwrongwords.get(i)).getSuggestionCount(); List allsuggestions = ((Words) allwrongwords.get(i)).getSuggestions(); out.println(" Palabra Errada: " + onewrongword + " "); out.println(" " + onewordsuggestioncount + " Sugerencias: "); for (int k = 0; k < allsuggestions.size(); k++) { String onesuggestion = (String) allsuggestions.get(k); out.println(onesuggestion); } out.println(" "); out.println(" Resumen: " + no_of_mistakes + " Errores ("); for (int i = 0; i < allwrongwords.size(); i++) { String onewrongword = ((Words) allwrongwords.get(i)).getWord(); out.println(onewrongword); } out.println(")."); out.println(" "); } catch (Exception ex) { out.println("exception" + ex); } finally { out.close(); }

You see a number of error bars and warning icons, indicating classes that are not found. To fix imports after pasting the code, right-click anywhere, which opens a context menu, and select Fix Imports. (You have a choice of List classes to import. Accept the default java.util.List.) The full list of imported classes follows: import com.cdyne.ws.Check; import com.cdyne.ws.Words; import java.io.IOException; import java.io.PrintWriter; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.ws.WebServiceRef;

Deploying the Client The IDE uses an Ant build script to build and run your application. The IDE generates the build script based on the options you entered when creating the project. You can fine tune these options in the project's Project Properties dialog box (right-click the project node in the Projects window and choose Properties). 1.Right-click the project node and choose Run. After a while, the application deploys and displays the JSP page that you coded in the previous section. 2.Enter some text, making sure that some of it is incorrectly spelled: