Java Web Services By Tyler Jewell, David Chappell The unconfirmed error reports are from readers. They have not yet been approved or disproved by the author or editor and represent solely the opinion of the reader. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification This page was updated March 11, 2003. UNCONFIRMED errors and comments from readers: [1] Examples download; In the examples file "JavaWebServices_Examples_README.txt", the steps for setting up Tomcat 3.2.4, steps 3 and 4 should be switched. You can't call http://localhost:8080/soap/servlet/rpcrouter until you have the soap.war installed, which occurs in step 4. --------------------------------- SETTING UP TOMCAT 3.2.n 3. Test the revised installation. a. Start tomcat again. b. Open a browser and enter the address: http://localhost:8080/soap/servlet/rpcrouter The response expected is: "Sorry, I don't speak via HTTP GET- you have to use HTTP POST to talk to me.". c. Close the Tomcat window. 4. Set up Tomcat for SOAP. a. Copy the SOAP webapps file soap.war into the 3.2.n Tomcat \webapps directory. b. Start tomcat again. c. In a browser, enter "http://localhost:8080/soap" The expected result is an Apache SOAP page with options to 'Run the admin client' and to access the SOAP RPC router. {README} SETTING UP TOMCAT 3.2.n; The following changes need to be made to the README file for the examples and also to the example directories themselves. These changes are applicable to the 9780596002695_examples.zip whose size is 192693 bytes. After you unzip the above file make the following changes the to JavaWebServices_Examples_README.txt file. 1) Under the section SETTING UP TOMCAT 3.2.n make the following documentation changes: - Step 5c: Change the value of 'ID Value' from "urn:stockhand" to urn:sotck-onhand" Change the value of 'Static' from "no" to "false" (Note that Step 5c is here to show you how to use the web interface to create a deployment descriptor, you could have just as easily applied Step 5d to the file %WORK%\examples\ch4\StockQtyDD.xml and had the same result.) - Step 5d: Remove the tildes '~' from the java cmd. Now make the following file/directory changes prior to following the instructions in Step 5 under the section SETTING UP TOMCAT 3.2.n. 1) Delete the following files: (note that these files exist elsewhere in the example directory heirarchy so we are only removing them from where they should not be) - %WORK%\examples\ch3\src\PurchaseOrderAcceptor.* - %WORK%\examples\ch3\StockQtyDD.xml 2) Move %WORK%\examples\ch4\src\StockQuantity.java to %WORK%\examples\tomcat_3_webapps\src\ 3) After modifying the batch file %WORK%\examples\setenv_jaws.bat to reflect your installation environment, execute the batch file. 4) Go to the directory %WORK%\examples\tomcat_3_webapps\src and ... - execute the command javac *.java - move the generated *.class files to ..\classes 5) Go to the directory %WORK%\examples\ch3\src and ... - execute the command javac *.java - move the generated *.class file to ..\ 6) Go to the directory %WORK%\examples\ch4\src and ... - execute the command javac *.java - move the generated *.class file to ..\ Now continue with Step 5 under the SETTING UP TOMCAT 3.2.n section. At this point all the examples in chapter 3 and 4 will work properly except for for two things. 1) The example on page 54 which for me at least generates the following message: ______________________________________________________ Starting GetBookPrice: service url = http://services.xmethods.com:80/soap/servlet/rpcrouter ISBN# = 0596000685 _______________________________________________________ Error opening socket: Connection refused: connect Though this may be an issue on my side, I just haven't looking into it further. 2) The example on page 55 does generate the output as shown page 55 but in addition it generates the following error: ______________________________________________________ Starting GetBookPrice: service url = http://D4893.na.sas.com:8080/examples/servlet/SimpleHTTPReceive ISBN# = 0596000686 _______________________________________________________ Parsing error, response was: The root element is required in a well-formed document (3 print; 1.1.1 online) The Major Web Services Technologies; http://safari.oreilly.com/main.asp?bookname=9780596002695&snode=11 However, the web service vision of seamless worldwide business integration is not be feasible unless the core technologies are supported by every major software company in the world. typo -> is not be feasible -> will not be feasible [6] 3rd paragraph; Southwest Airlines runs Solaris; Dollar Compaq's OpenVMS together with ACMS (Application Control and Management System - a TP system). In other words: the operating systems are reversed. [40] 2nd paragraph; HTTPReceive.class in examples/tomcat_3_webapps/classes does not seem to be compiled from HTTPReceive.java that is found in examples/tomcat_3_webapps/src. Here is a decompled code of HTTPReceive.class: -------------------------------- // Decompiled by Jad v1.5.8c. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: packimports(3) // Source File Name: HTTPReceive.java import java.io.*; import java.util.Enumeration; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.http.*; public class HTTPReceive extends HttpServlet { public HTTPReceive() { } public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { System.out.println("Received GET request"); response.setStatus(400); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { System.out.println("____________________________"); System.out.println("JAXM Servlet received POST request."); System.out.println("-----------------------"); String header; String value; for(Enumeration enum = request.getHeaderNames(); enum.hasMoreElements(); System.out.println(" " + header + " = " + value)) { header = (String)enum.nextElement(); value = request.getHeader(header); } System.out.println("-----------------------"); if(request.getContentLength() > 0) try { BufferedReader reader = request.getReader(); for(String line = null; (line = reader.readLine()) != null;) System.out.println(line); } catch(Exception e) { System.out.println(e); } System.out.println("____________________________"); } } -------------------------------- (41) 2nd paragraph; we get the Vector of BodyEntrys from the Envelope and get the Body from the Vector: should be: we get the Body from the Envelope and get the Vector of BodyEntrys from the Body: {42} code listing; The last line of the method is listed as: response.setContentType("text/xml"); but the compiled class does not have this line. So, class has to be recompiled, otherwise an error is thrown when HTTPReceive is used as the -url parameter. {55} 4th paragraph; The output is correct in the servlet window, but (at least on my install) the response from the execution (command window) is: ______________________________________________________ Starting GetBookPrice: service url = http://localhost:8080/examples/servlet/SimpleHTTPReceive ISBN# = 0596000685 _______________________________________________________ Parsing error, response was: Document root element is missing. (56) SOAP XML code, center of the page; Currently Reads: Java And Web Services</isbn> Should read: <title xsi:type="xsd:string">Java And Web Services (71) 2nd last line; protocal -> protocol (72) 3rd paragraph; The word "discreet" should instead be "discrete" {74} WSDL example, center of page; The WSDL example that shows the major elements forget to close the import tag. It has but it should be . Minor mistake but in XML it is illegal to omit a closing tag and this would cause an error from an XML parser. (76) 2nd Paragraph; Last line of this paragraph states that that the target name space in the example wsdl definitions element is "http://asf.gils.net/xer". It's not. The target name space shown is "urn:3950". [87] last paragraph of chapter; "The value assigned to the name attribute of each element must be unique within the scope of the ." The value of the name attribute of each doesn't have to be unique. "Operation overloading" is allowed. In case of operation overloading the correct operation in the corresponding binding section must be identified by providing the name attributes in the corresponding input and output elements. See: http://www.w3.org/TR/wsdl#_bindings (101) First line; ... nodes that has their.... -> ... nodes that have their.... (102) first paragraph, last url; http://www.opensorcerer.org is a bad link! (143) Table 7-1; The description for SOAPBody and SOAPBodyElement are reversed. (193) First line, second paragraph; specificationss -> specifications