Java Webservices - newbie question.....

Y

yekasi

hi,

I used to be a .net programmer for a few years, and am have done web
services in .net.... (using IIS, of course)

And i moved onto Java side recently - and am pretty new to tomcat /
axis..etc..

I looked at the netbeans ide tutorial, and it covered on how to create
a web services and a client using the IDE - with that is with the sun
app server. Since I want to stick with Tomcat (which is a servlet
container, i believe), the compilation complained that the
HelloWSImpl.java is not a servlet, and will not let me run the web app.
I have tried the WSDP 2.0 tutorial as well, but I first got the
FastSetsource.jar not found? Then I got some other classes not
found..etc... so, until now - i still am not able to create a web
service, and a cliet to talk back and forth.

I have the following questions..

1. I am confused that how come tomcat itself is already a webserver,
why would people use it on top of apache http server, which is another
web server?

2. To create a web services, (I am thinking of the .net web services
that i have done - that once you deploy it with IIS, and you browse to
that service, if the function takes 2 parameter, there will be 2
textboxes waiting for you to put data to, then once you post - the xml
response will come back...), does java allow front end interface
automatically like that in .net? Or you have to code the JSP pages to
include those textboxes yourself, and do a manual post to the web
services address?

3. Are there any book out there, explains how to use tomcat for
webservices? I have looked thru some of the java books that talks about
web services, they mainly explain what webservices are, what is
xml..etc... and of course, they did talk about the differenct type of
messaging format available. (JAX-RPC..etc..)

4. In the java world - how do you use webservices? Is it the same way
that i am familiar with? Like, that we have a front end gui, that it
will call the web services, pass it a few param, and get the xml result
back, and parse it and display / store.. it? Or that is not the correct
way to consume the web services in java world?

5. In .net - as long as i have the .net framework sdk, and a IIS - i am
good to go. In java - what do i need in order to deploy a web
services?? I already have tomcat / jdk / wsdp / IDE - do i have enough
to create a simple ws? if so, can you show me a basic tutorial??

based on some reading, i understand that the ws on the service side,
needs an SEI implementing java.rmi.remote, and we need another class
implementing this SEI. But I would really want to see more example, or
downloads, where i can just download / view the whole thing all at
once... I googled "java web service", "jax-rpc example"..etc.. most of
the return links are from either java.sun.com, or ibm, or some other
vendor's web site, explaining the architecture... I really want to look
at the code, to get a better understand, what is the relationship
between each of these softwares (tomcat, apache http server, axis...)

Any suggestions??

Thanks,
T
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

1. I am confused that how come tomcat itself is already a webserver,
why would people use it on top of apache http server, which is another
web server?

Apache HTTPD in front of Tomcat is not needed but sometimes
preferred.

Examples of reasons:
- serving non JSP content like PHP
- load balancing over multiple Tomcat
- usage of hardware SSL accelerator
2. To create a web services, (I am thinking of the .net web services
that i have done - that once you deploy it with IIS, and you browse to
that service, if the function takes 2 parameter, there will be 2
textboxes waiting for you to put data to, then once you post - the xml
response will come back...), does java allow front end interface
automatically like that in .net? Or you have to code the JSP pages to
include those textboxes yourself, and do a manual post to the web
services address?

Web services are by definition something that is called by programs
not browsers.

..NET has this nice little test feature. I do not belive Axis
offers that service.

You do not do a manual post - you let Axis generate a stub
and call that.
3. Are there any book out there, explains how to use tomcat for
webservices? I have looked thru some of the java books that talks about
web services, they mainly explain what webservices are, what is
xml..etc... and of course, they did talk about the differenct type of
messaging format available. (JAX-RPC..etc..)

Axis comes with docs about how to use it.
4. In the java world - how do you use webservices? Is it the same way
that i am familiar with? Like, that we have a front end gui, that it
will call the web services, pass it a few param, and get the xml result
back, and parse it and display / store.. it? Or that is not the correct
way to consume the web services in java world?

Using web services in java and .NET is more or less the same.

You deploy your web service code. The container generates all
the extra stuff on the server side. For the client side you generate
a stub and call that.

Neither in Java or .NET you usuall parse the SOAP XML yourself.
5. In .net - as long as i have the .net framework sdk, and a IIS - i am
good to go. In java - what do i need in order to deploy a web
services?? I already have tomcat / jdk / wsdp / IDE - do i have enough
to create a simple ws? if so, can you show me a basic tutorial??

You need:
* JDK (to compile your code and run Tomcat)
* Tomcat (or another servlet container)
* Axis (either to deploy as a the axis web app or to grab pieces and
deploy as your own web app)

IDE is optional.

JWSDP is an alternative to Axis.
based on some reading, i understand that the ws on the service side,
needs an SEI implementing java.rmi.remote, and we need another class
implementing this SEI. But I would really want to see more example, or
downloads, where i can just download / view the whole thing all at
once... I googled "java web service", "jax-rpc example"..etc.. most of
the return links are from either java.sun.com, or ibm, or some other
vendor's web site, explaining the architecture... I really want to look
at the code, to get a better understand, what is the relationship
between each of these softwares (tomcat, apache http server, axis...)

You do not need to think about all that. You just write your web service
logic and deploy it.

The Axis guide do have examples.

Arne
 
Y

yekasi

Arne said:
Apache HTTPD in front of Tomcat is not needed but sometimes
preferred.

Examples of reasons:
- serving non JSP content like PHP
- load balancing over multiple Tomcat
- usage of hardware SSL accelerator

What are come reasons that you will need multiple of Tomcat? Doesnt
tomcat allow you to deploy multiple servlet / applications?

Web services are by definition something that is called by programs
not browsers.

.NET has this nice little test feature. I do not belive Axis
offers that service.

You do not do a manual post - you let Axis generate a stub
and call that.

Thats what I meant by "the browser", the test function... Do you konw
if WSDP generateds that test function? I am thinking of one situation,
that the test function page will come in handy..

Say, i developed a few web services, which are some basic arithmetic
addition / subtraction / mul / div..etc.. Say another developer wants
to call my ws, but he would like to see what is available for him to
use... I used to just give the other developer the link to the ws, and
he will see all methods available via the "browser test page". In java
world, what do you do when situations like that happen if the developer
wants to see it first, before any coding on his end??


You need:
* JDK (to compile your code and run Tomcat)
* Tomcat (or another servlet container)
* Axis (either to deploy as a the axis web app or to grab pieces and
deploy as your own web app)

IDE is optional.

JWSDP is an alternative to Axis.

Am I right on this - that java ws must be deployed in a servlet
container? So, does that mean, java ws is a servlet itself? I followed
some tutorial in netbeans IDE 5.0 - which is to create a web services
and deploy it as servlet, but his example was using a sun app server. I
followed everything, except that I am using tomcat instead of sun app
server... when I try to run the ws - it complained that my class is not
a servlet. But in the code, there was nothing about inheriting anything
servlet class, it just implements the SEI, and java.rmi.remote... So
the webapp would not start..


A few more questions...

1. apache soap - based on some reading, it is also some package that
allow you to develop ws. Is that just the same thing as an alternative
from using JWSDP, Axis...?

2. WSDL - let say i am NOT using axis (i know axis comes with java2wsdl
and vice versa), are you suppose to write the wsdl yourself? Or the
container / IDE is capable generating that as well? If so, which one
will do it, and how do you generate the wsdl?

Thanks!
T
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

What are come reasons that you will need multiple of Tomcat? Doesnt
tomcat allow you to deploy multiple servlet / applications?

Load balancing over Tomcat's running on multiple physical boxes
to achieve redundancy and horizontal scalability.
Say, i developed a few web services, which are some basic arithmetic
addition / subtraction / mul / div..etc.. Say another developer wants
to call my ws, but he would like to see what is available for him to
use... I used to just give the other developer the link to the ws, and
he will see all methods available via the "browser test page". In java
world, what do you do when situations like that happen if the developer
wants to see it first, before any coding on his end??

Tell him to generate a stub and look at the code.

Or read the WSDL if he is hardcore.
Am I right on this - that java ws must be deployed in a servlet
container? So, does that mean, java ws is a servlet itself?

A web service need a permanent running server accepting HTTP requests.

I am not aware of any Java web service toolkit that does not
use a servlet.

No your web service is not a servlet. There are an Axis servlet
that dispatches to your web services.
> I followed
some tutorial in netbeans IDE 5.0 - which is to create a web services
and deploy it as servlet, but his example was using a sun app server. I
followed everything, except that I am using tomcat instead of sun app
server... when I try to run the ws - it complained that my class is not
a servlet. But in the code, there was nothing about inheriting anything
servlet class, it just implements the SEI, and java.rmi.remote... So
the webapp would not start..

Follow the Axis guide. Start with .jws file and go on to deploying
with .wsdd files.
A few more questions...

1. apache soap - based on some reading, it is also some package that
allow you to develop ws. Is that just the same thing as an alternative
from using JWSDP, Axis...?

Apache SOAP is Axis version 0. Or Axis has replaced Apache SOAP.
2. WSDL - let say i am NOT using axis (i know axis comes with java2wsdl
and vice versa), are you suppose to write the wsdl yourself? Or the
container / IDE is capable generating that as well? If so, which one
will do it, and how do you generate the wsdl?

I use Axis to generate WSDL. The .NET runtime generate the WSDL.
I would not use a web service toolkit that does not generate the WSDL.

(and you do not use java2wsdl with Axis - you let the Axis runtime
generate it)

Arne
 
T

tak

2. WSDL - let say i am NOT using axis (i know axis comes with java2wsdl
I use Axis to generate WSDL. The .NET runtime generate the WSDL.
I would not use a web service toolkit that does not generate the WSDL.

(and you do not use java2wsdl with Axis - you let the Axis runtime
generate it)

I was able to generate the wsdl, and get the ws up and running using
axis (so easy to use). On the other hand - i would like to get more
understand on netbeans, and the ws without using axis.... i created a
web application, with a ws in it, using netbeans, and it compiles...
but i cannot seem to let me generate the wsdl document for me. How do
you generate wsdl document in netbeans?? inside the WEB-INF folder,
there is a wsdl folder, and it is empty...

ideas?

thanks,
T
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

tak said:
I was able to generate the wsdl, and get the ws up and running using
axis (so easy to use). On the other hand - i would like to get more
understand on netbeans, and the ws without using axis.... i created a
web application, with a ws in it, using netbeans, and it compiles...
but i cannot seem to let me generate the wsdl document for me. How do
you generate wsdl document in netbeans?? inside the WEB-INF folder,
there is a wsdl folder, and it is empty...

I do not use Netbeans.

I do not generate WSDL myself - I let Axis generate that
dynamicly.

Arne
 
T

tak

Arne said:
I do not use Netbeans.

I do not generate WSDL myself - I let Axis generate that
dynamicly.

Arne

One more question. What IDE do you use? or you do not use IDE? (Trying
to figure out what works best with axis.)

Thanks,
Tak
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

One more question. What IDE do you use? or you do not use IDE? (Trying
to figure out what works best with axis.)

I use Eclipse for coding (used to be JBuilder).

But I do all the building and deploying with
ant scripts (outside Eclipse).

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top