I have summarized my effort in creating and publishing a web service below
for anyone who might be interested. This method worked for me. Getting
instructions on how to go through this process was not straight forward so I
have put together the following information for future references. Hopefully
it will help other people get going in the right direction.

Cheers - Alan

*******************************************************************

Creating and publishing Java Web Services Interfaces using Eclipse and the
Web Tools Platform (WTP).

Software packages that are involved with this process include but not
limited to the following list...

**********************************

The following were installed on my development machine running Windows XP
Professional.

The Eclipse Integrated Development Environment (IDE) can be found in the
following link, I'm using version 3.1.2:
http://www.eclipse.org/downloads/

The plugin for developing Web Services (WTP) can be found in the following
link, I'm using version 1.0.2:
http://www.eclipse.org/webtools/

Eclipse NewsPortal for webtools is in the following link:
http://www.eclipse.org/newsportal/thread.php?group=eclipse.webtools

**********************************

I'm using the Apache Tomcat Application server along with Axis (for SOAP
services), jUDDI (UDDI registry server) and MySql as the DBMS. All were
installed on a Linux Red Hat version 3 box.

Tomcat can be found in the following link, I'm using version 5.5.17:
http://tomcat.apache.org/

Axis can be found in the following link, I'm using version 1.4:
http://ws.apache.org/axis/

The jUDDI server can be found in the following link, I'm using version
0.9rc4 (UDDI version 2.0):
http://ws.apache.org/juddi/

jUDDI User forum/mailing list is in the following link:
http://www.nabble.com/jUDDI---User-f240.html

MySql download can be found in the following link, I'm using version
5.0.22-linux-i686:
http://dev.mysql.com/downloads/

**********************************

1) Install and configure the Tomcat Application Server, Axis, jUDDI and
MySql on your target platform/machine, i.e. where your Web Services
Application will finally reside.

2) Install and configure the Tomcat Application Server and Axis on your
development machine. You will need them for integrating with Eclipse.

3) Install and configure Eclipse and WTP on your development machine.

4) Create a Tomcat server in the Eclipse workbench by following the
instructions at the following link:

http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.jst.ws.axis.ui.doc.user/tasks/ttomcatserv.html

Test and make sure that the installations from steps 1-4 work properly
before continuing.

The following steps are done using the Eclipse IDE along with the WTP
plugin:

5) Create a "Dynamic Web Project" by doing the following inside of Eclipse:
- File->New->Dynamic Web Project
- Give the project an appropriate name and select the "Finish" button. We'll
call it "myApp" as
  a reference in this document.

6) Create your Java class with the public methods that you will be using as
your Web Service Interfaces - this is called bottom up web design. Do this
as follows:
- RIGHT click on the "myApp" project and select
  New->Class
- Give an appropriate package name (e.g. my.org.name) and class name (e.g.
MyWebClass) and select the "Finish" button.
- Finish coding up the public methods for the "MyWebClass" class.
- Make sure your project has all the required jar files in its "Java Build
Path", i.e. do the following:
RIGHT click on your project and select "Properties", then under "Java Buile
Path" add all the required jar files needed the compile your class.
- Make sure you build your project so that your class is available in the
output folder (e.g. build/classes/...), i.e. do the following to create the
class files:
Project->Build Project

7) RIGHT click on the "MyWebClass" class and do the following to create the
WSDL and the test client:
- Web Services->Create Web Service
- In the "Web Services" window, check the "Generate a proxy" and "Test the
Web service" boxes then select Next->Next->Next.
- In the "Web Service Java Bean Identity" window, notice where your "Web
service URI" is located, this will be the location of your service when you
publish the interface later. You can change the URI in the WSDL document
later. Also notice the "WSDL File" that will be created by the wizard. To
access the WSDL document using a browser, you add the string "?wsdl" to the
end of the "Web service URI" string. The "WSDL File" is also located in the
folder indicated by the field "WSDL Folder".
- Check all methods that you want to be available for your Web Services
interface.
- Select the appropriate "Style and Use" for your interface then click on
the "Next" button
- In the "Server startup page" window, click on the "Start server" button to
start Tomcat.
- Once Tomcat has started successfully, click on the "Next" button.
- In the "Web Services Test Page" window, click on the "Next" button.
- In the "Web Services Proxy Page" window, click on the "Next" button.
- In the "Web Services Client Test" window, make sure the "Run test on
server" option is UNCHECKED then click on the "Next" button.
- In the "Web Services Publication" window, click on the "Finish" button.

8) Once the "Web Services Test Client" window come up, you can test your
interfaces. I have found that testing the interfaces using this mechanism
may result in perculiar behaviors. What works better is to migrate your
project to Tomcat by doing the following on the target machine:
8.1 - Stop Tomcat on the target machine/platform.
8.2 - Create a directory with the SAME name as your project, in this case
it's "myApp", under the following directory -> TOMCAT_HOME/webapps which
should result in something like TOMCAT_HOME/webapps/myApp
8.3 - Copy all contents under the "WebContent" folder for your project from
your development machine (e.g. C:\EclipseWorkspace\myApp\WebContent\*.*) to
the target machine under TOMCAT_HOME/webapps/myApp.
8.4 - If your Eclipse output folder is defaulted to the "build" folder, then
copy the "classes" folder for your project from your development machine
(e.g. C:\EclipseWorkspace\myApp\build\classes) to the target machine under
TOMCAT_HOME/webapps/myApp/WEB-INF.
8.5 - You should now have a similar directory structure as the following on
your target machine:

--> TOMCAT_HOME/webapps/myApp/META-INF
--> TOMCAT_HOME/webapps/myApp/WEB-INF
--> TOMCAT_HOME/webapps/myApp/WEB-INF/classes
--> TOMCAT_HOME/webapps/myApp/wsdl

8.6 - Eclipse should have created the client application project that you
can use to test your Web Services, it has the same name as your project's
name with the word "Client" appended to it, for this discussion it would be
"myAppClient". The code for the client can be used to create your own client
classes to access your Web Service Interfaces, so you can make good use of
it.

8.7 - Repeat steps 8.2-8.5 and migrate the client application (e.g.
myAppClient) to TOMCAT/webapps too.

9) Start Tomcat on the target machine and Tomcat should recognize your new
web applications located under the TOMCAT_HOME/webapps directory. You can
access and test the "myApp" Web Services by running the "myAppClient" JSP
that was created by Eclipse. The typical URL for the client JSP is as
follows (notice that it uses your application name and class name):
http://localhost:8080/myAppClient/sampleMyWebClass/TestClient.jsp

10) Make changes to your "MyWebClass" accordingly using Eclipse and copy the
"MyWebClass.class" file from your development machine (e.g.
C:\EclipseWorkspace\myApp\build\classes\myPackageName\...\MyWebClass.class)
to the target machine (e.g.
TOMCAT_HOME/webapps/myApp/WEB-INF/classes/myPackageName/.../MyWebClass.class).
Restart Tomcat on the target machine and retest until everything is in order
and your Web Services Interfaces are working as required.

11) At this point, using your Java class, you have successfully created your
Web Services Interfaces and their WSDL document - the WSDL document lives
under the TOMCAT_HOME/webapps/myApp/wsdl directory and can be accessed using
the browser via a URL similar to the following:
http://localhost:8080/myApp/services/MyWebClass?wsdl

Using the following URL will show you some other WSDL interfaces created by
Eclipse:
http://localhost:8080/myApp/services

**********************************

Publishing the WSDL document into the UDDI registry...

Next we want to publish the "myWebClass" WSDL into a UDDI registry/server.
In this example we will be using the jUDDI server that was installed on our
target machine. If the jUDDI server was installed correctly, its main page
should be at a URL similar to the following:
http://localhost:8080/juddi

By looking in the "controller.jsp" file that resides under the
TOMCAT_HOME/webapps/juddi/console directory, we can see that the "inquiry"
URL is something like "http://localhost:8080/juddi/inquiry"; - we will need
this URL later in the wizard.

1) Bring up Eclipse and do:
run->Launch the Web Services Explorer

2) In the Web Services Explorer window, click on the "UDDI Main" link.

3) For the "Inquiry URL" field enter the jUDDI inquiry URL that you got from
the "controller.jsp" file, e.g.
http://localhost:8080/juddi/inquiry

4) Give the jUDDI server an appropriate name for the "Registry Name" field,
e.g. "My jUDDI", then click on the "Go" button.

5) In the "Registry Details" screen, under "Other Actions", you can click on
the "Add To Favorites" link to add your jUDDI registry server to the drop
down list (for future usage).

6) In the "Registry Details" screen, under "Other Actions", click on the
"Publish" link to bring up the "Publish" screen. Use the following options
to publish the "MyWebApp" services:

- Publish -> Service Interface
- Publication format -> simple
- Publish URL -> http://localhost:8080/juddi/publish
- User ID -> myUserId (this is the user ID that you have allowed to use the
jUDDI database)
- Password -> 
- WSDL URL -> platform:/resource/myApp/WebContent/wsdl/MyWebClass.wsdl
- Name -> My Application
- Description -> My Web Class Services

For the "WSDL URL" field, you must use the browse button to select the myApp
project and Eclipse should be able to find the WSDL document from that
project and import it into that field.

Notice that the "Publish URL" is the URL for the jUDDI server's "publish"
address (i.e. where we're publishing the WSDL document) and NOT where the
MyWebClass service interface lives (i.e. not
http://localhost:8080/myApp/services/MyWebClass).

**********************************

Searching for the Service...

1) Bring up Eclipse and do:
run->Launch the Web Services Explorer

2) In the Web Services Explorer window, click on the "UDDI Main" link.

3) For the "Inquiry URL" field enter the jUDDI inquiry URL that you got from
the "controller.jsp" file, e.g.
http://localhost:8080/juddi/inquiry or use the drop down list if you had
saved it already.

4) In the "Registry Details" screen, under "Other Actions", click on the
"Find" link to bring up the "Find" screen.

5) Use the following options in the "Find" screen to find your service:

- Search for -> Service Interfaces
- Type of search -> simple
- Name -> My Application (or whatever "Name" you used in step 6 above)

Click on the "Go" button and the information for the "MyWebClass" services
should be displayed. Notice that you can "Edit" certain fields such as the
"WSDL URL" field. You might want to use the actual URL for the Web Services
such as http://my.host.machine.name:8080/myApp/services/MyWebClass?wsdl
instead of the default one listed in the MySql database, e.g.
"platform:/resource/myApp/WebContent/wsdl/MyWebClass.wsdl"

-- 
View this message in context: 
http://www.nabble.com/Creating-and-publishing-Web-Services-to-jUDDI-tf2128286.html#a5873118
Sent from the jUDDI - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to