ByJoel Barnum, Descriptor Systems.
In this article, you will learn how to install the open-source jUDDI server andconfigure it. InPart 2,you will publish a Web service's WSDL to it.
This article assumes that you are familiar with SOAP, WSDL and UDDI, as these topics will not be explored here.
Blatant, shameless plug: If you arenotfamiliar with SOAP, WSDL and UDDI, Irecommend that you get some Web services training from Descriptor Systems. Youcan find more information atwww.descriptor.com. Thanks!
Update:Unfortunately, these in structions do NOT work if you have Java 1.6 installed. Apparently, there is abug with no work around due to a conflict between jUDDI and Java 6.
Update#2:ThereISa work around! To fix the Java 6 bug,after installing Tomcat, add the following to the top of the$TOMCAT_INSTALL/bin/catalina.sh (or catalina.bat):
SET JAVA_OPTS=-Djavax.xml.soap.SOAPFactory=org.apache.axis.soap.SOAPFactoryImpl
-Djavax.xml.soap.MessageFactory=org.apache.axis.soap.MessageFactoryImpl
-Djavax.xml.soap.SOAPConnectionFactory=org.apache.axis.soap.SOAPConnectionFactoryImpl
Theabove should all be on a single line.
Hereare the software packages you will need:
1. Install theJava Standard Edition according to the instructions on the Sun website. Installthe JSE'sbindirectory into the PATH as is normalfor your operating system.
2. InstallApache Tomcat according to the instructions from the Apache website. Note theinstallation directory -- we will refer to it as theTOMCAT-HOMEin this article.
3. Unzip theHypersonicSQL archive to a directory of your choice. We will refer to this astheHSQL-HOMEin this article.
4. Unzip thejUDDI archive to a directory of your choice. We will refer to this as theJUDDI-HOMEin this article.
5. Copy the{HSQL-HOME}/lib/hsqldb.jarto{TOMCAT-HOME}/common/lib.This makes the HypersonicSQL database runtime available to Tomcat.
6. Create adirectory underTOMCAT-HOMEnameddb. We will create the HSQLDBdatabase for the UDDI storage here.
7. Next, youwill create the UDDI database. Open a command prompt window or terminal andchange to the{TOMCAT-HOME}/common/libdirectory. Then enter the following tostart the HSQLDB admin GUI:
8. java -cp hsqldb.jar org.hsqldb.util.DatabaseManager
In the GUI, enter or select the following,leaving the rest as their default values:
Type: | HSQL Database Engine Standalone |
URL: | jdbc:hsqldb:file:{TOMCAT-HOME}/db/uddi |
Be sure to substitute the actual pathname for{TOMCAT-HOME}(note that forward slashes are OK evenin Windows). Then press OK.
9. In theHSQLDB GUI, chooseFile - OpenScriptand navigate to the{JUDDI-HOME}/sql/hsqldbfolder, then select thecreate_database.sqlscript and press Open. To run thescript, press theExecutebutton. The HSQL GUI will report an"Update Count" of 1.
10. Repeat theabove step to open the{JUDDI-HOME}/sql/hsqldb/insert_publishers.sqlscript. Before executing it, removethe "--" comment characters in front of theINSERTandVALUESlines in the script. After executing,you should see an "Update Count" of 1.
You can then chooseView - Refresh Treefrom the GUI's menu to see thedatabase tables.
To further test, highlight and delete the textINSERT command text and then enter:
SELECT COUNT(*) FROM PUBLISHER
You should see a result of "1". Closethe GUI when you are finished.
11. Copy the{JUDDI-HOME}/webapps/juddidirectory to{TOMCAT-HOME}/webapps. Youshould end up with a{TOMCAT-HOME}/webapps/juddidirectory that containsindex.html,happyjuddi.jspand several subdirectories. Thisinstalls the jUDDI web application into Tomcat.
12. In the{TOMCAT-HOME}/webapps/juddi/META-INFdirectory,create a file namedcontext.xml.Enter the following into the file:
13. <Context path="/juddi" docBase="juddi" debug="5" reloadable="true"
14. crossContext="true">
15. <Logger className="org.apache.catalina.logger.FileLogger"
16. prefix="localhost_juddiDB_log" suffix=".txt"
17. timestamp="true"/>
18.
19. <Resource name="jdbc/juddiDB"
20. auth="Container"
21. type="javax.sql.DataSource"
22. username="sa" password=""
23. driverClassName="org.hsqldb.jdbcDriver"
24. url="jdbc:hsqldb:file:{TOMCAT-HOME}/db/uddi"
25. validationQuery="select publisher_ID from PUBLISHER"/>
26. <Resource name="jdbc/juddi"
27. auth="Container"
28. type="javax.sql.DataSource"
29. username="sa" password=""
30. driverClassName="org.hsqldb.jdbcDriver"
31. url="jdbc:hsqldb:file:{TOMCAT-HOME}/db/uddi"
32. validationQuery="select publisher_ID from PUBLISHER"/>
33. </Context>
Be sure to replace the{TOMCAT-HOME}placeholders with the actual pathname.This file configures two DataSources so that the jUDDI application can use theHSQLDB database tables you created in an earlier step.
34. Edit the{TOMCAT-HOME}/webapps/juddi/WEB-INF/web.xmlfile and near the bottom, copy theexistingresource-refelement so there are two. Edit thecopy to define ares-ref-nameofjdbc/juddi.The tworesource-refelements should look like:
35. <resource-ref>
36. <description>jUDDI DataSource</description>
37. <res-ref-name>jdbc/juddiDB</res-ref-name>
38. <res-type>javax.sql.DataSource</res-type>
39. <res-auth>Container</res-auth>
40. </resource-ref>
41. <resource-ref>
42. <description>jUDDI DataSource</description>
43. <res-ref-name>jdbc/juddi</res-ref-name>
44. <res-type>javax.sql.DataSource</res-type>
45. <res-auth>Container</res-auth>
46. </resource-ref>
47. In thecommand prompt or terminal window, change to the{TOMCAT-HOME}/binfolder and start Tomcat by enteringone of the following, depending on your operating system:
48. catalina run -- for Windows
49. ./catalina.sh run -- for *nix
50. Test jUDDIby opening a Web browser and entering the following URL:
51. http://localhost:8080/juddi/happyjuddi.jsp
You should not see any errors on the page (no red text).
52. One finaltest. Enter the following URL into your browser:
53. http://localhost:8080/juddi/console/get_authToken.jsp
In the top multi-line entry area, change theuserIDfrom***tojdoeand thecredfrom***to an empty string. Then press theSubmit button.
In the bottom multi-line area, you should see areturned SOAP message with anauthInfoelement containing text of the formauthToken:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.If that worked, then you have successfully installed and configured jUDDI!
文章来源:http://www.descriptor.com/articles/web-services/juddi.html