Jiang Yulin (vincent@ilab.el.cycu.edu.tw)
Internet Laboratory of Internet of Zhongyuan University
The first step in the tool and installation to build the first web service is to select a toolset. The tools that will be used are:
Apache SOAP - SOAP This open source Java implements a support for subset useful for SOAP 1.1 specification and is well integrated with existing Web Service. Please download soap-bin-2.0.zip from http://xml.apache.org/soap/index.html. Apache Jakarta Tomcat - Java Web Server also implements the Java Servlets 2.2 API specification required for host Apache SOAP 2.0. Please go to http://www.apache.org/dist/jakarta/jakarta-tomcat-4.0/release/v4.0.3/ download Apache Jakarta Tomcat 4.0. Apache Xerces XML Parser 1.2.3 - This Open Source XML Syntax Analyzer implements most of the latest XML specification and is used by Apache SOAP 2.0. Please go to http://xml.apache.org/xerces-j/ download Xerces-j-bin-1.2.3.zip. If each installation file is decompressed to the root directory, the directory structure shown below should be obtained.
/
/JAKARTA-TOMCAT-4.0
/ lib - contains webserver.jar, servlet.jar, jasper.jar, parser.jar, jaxp.jar
/ SOAP-2_0
/ lib - contains soap.jar
/ Xerces-1_2_3 - Contains Xerces.jar
The next thing to do is to add Xerces and SOAP .JAR files to classpaths to ensure Xerces.jar in front. If you don't do this, Apache SOAP may find the wrong XML .jar file, so you can't work correctly. The author adds two two items to classpaths on their own system:
C: / xerces-1_2_3/xerces.jar
C: /Soap-2_0/lib/soap.jar
Finally, you must configure Tomcat by editing /jakarta-tomcat-4.0/conf/server.xml and adding the
PATH = "/ soap" DocBase = "c: / soap-2_0 / webapps / soap" Reloadable = "True"> Context> Now we are ready to start building the first Web Service application. Start the Web Server Before starting writing your own Web Service, let's start Tomcat and start the SOAP Welcome page. To the start function table click Strat Tomcat This will start the Tomcat web server running on the local host port 8080. Should see the screens below: Then start the Web Verestor and enter the URL http://127.0.0.1:8080/soap. This will start the Apache SOAP that is installed to / SOAP when editing Tomcat Server.xml files. If these are correct, you will see the page opened in the following figure. At this point, turn off the traffic monitor and stop Tomcat. They will be restarted again after writing Web Service and preparing for deployment. Download Web Service Sample The author has written a simple Hello Web Service service, we can download the sample compressed hellowebservice.zip, release it to the / webApps, turn on the Tomcat. Deploying Web Service To deploy the Hello Web Service service. Then enter the URL to start the web conservation and enter the URL in the traffic. Http://127.0.0.1:8080/HellowebService/. Then click on the welcome screen when you see the welcome screen. Run the adminClient. Should be seen as shown below. This screen displays some options that allow us to deploy, unlined, and list resident services in the Tomcat / SOAP system. If you click the List option, you will see the service you want to start. To deploy the Hello Web Service service, click the Deploy option and the fill the field shown below. The following is an explanation of each field in the Deploy screen: ID: Web Service ID. In this example, we set the service logo to http://tempuri.org/hellowebservice scope: The service is started. Request means that every request creates a new service instance. Other use methods are session and Application. In this example, we set the service's startup mode to session. Methods: The method of delining by the space is displayed in the Web Service. Please note that this seems to imply that Web Service cannot display two symbol methods, but the SOAP specification does not prohibit this. In this example, our Methods is GET. Provider: Web Service type. Apache / SOAP currently only supports Java classes and bean scripts, but later versions will definitely support EJBs and other popular component types. In this case, we set the type of Web Service to Java. Provider class / static: Name of Java category. This class must be obtained by class path settings. If static is true, it is assumed that the method is a static method on the Java class, otherwise they will be processed as an instance method. In this example, we set the name of the Java category to HellowebService, Static Set to false. The other fields are related to the proprietary load (add-on) of the Apache / SOAP platform, and details will not be described later. After entering these fields, scroll down and click the Deploy button at the bottom of the window. It should be seen that a screen indicates that a service has been deployed. If you click the List button, you will see the listed web service's URN. Click its link, you should see the message as shown below. As described above, the deployment process is very simple. All information about the current deployment service is stored in the file named deployedservices.ds in the current directory by Tomcat / SOAP. Please be patient and read it - it contains a serialized Java hash table! Test the Web Service Example Enter the URL to start the Web Vault in the Competer and enter the URL http: // localhost: 8080 / hellowebservice / sample / hellowebservice / testclient.jsp. Should be seen as shown below. Here, we click on "Methods", will appear "Invoke" and "Clear" two buttons in the "INPUTS" page, and then call us to build it. Web Service and get Hello Web Service. As shown in the figure: Congratulations! We have just built and run the first Web Service application. Start now really enjoy your fun!