File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Beginning Web Services Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Beginning Web Services" Watch "Beginning Web Services" New topic
Author

Beginning Web Services

Srikanth Raghavan
Ranch Hand

Joined: Oct 31, 2005
Posts: 389
Hi,

I am very new to Web Services, please my questions may be silly. So far I have programmed only in J2SE and never in J2EE. I have a project that I'm gonna do in which I have to use Web Services.

There are a few services published and I have the WSDL documents of them. Now I must access these web services (I have to write a client to these published web services).

And in the other part of my project I have to write a few Web Services on my own and publish it for others to use. I am the only developer in my project and I have to make my own decisions in whatever I do. Here are my questions:-

1) How much time it may take to learn and write a Web Service client?
(This part of the project I must do quickly)
2) To publish my own web services, do I require a Container?
(I'll prefer it without a container if there is a choice, because I may have to manage the deployment of the container (like DD, Security) and I have not worked on this ever before and I am the only one in the project)
3) How much time it may take for someone like me to gain good knowledge that I can write and publish my own Web Services?
4) Any good books on Web Services in Java that you would recommend?

Thanks a lot,
Srikanth
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39535
    
  27
1) How much time it may take to learn and write a Web Service client?

Given the WSDL, it takes very little time to create a working client, since most WS engine come with tools that will generate the necessary Java classes for you (e.g., Axis comes with a tool called 'wsdl2java'). You won't have learned much by using the tool, but you'll have a working client.
2) To publish my own web services, do I require a Container?

Yes, but popular implementations like Axis come in the shape of a web application, which can be deployed in any servlet engine (or even as part of an existing web app).
3) How much time it may take for someone like me to gain good knowledge that I can write and publish my own Web Services?

Again, you can be up and running with publishing WS very quickly; the process isn't difficult. There'll be a number of things you need to learn eventually, though, and those will come only with experience.
4) Any good books on Web Services in Java that you would recommend?

The WebServicesLinks page lists a number of books. The last in the list (SOA - Using Java Web Services) was just discussed in this forum last week with the author answering questions.

You may also want to peruse the WebServicesFaq, which contains links to a number of introductory articles and other relevant material.
[ June 11, 2007: Message edited by: Ulf Dittmer ]

Ping & DNS - updated with new look and Ping home screen widget
Srikanth Raghavan
Ranch Hand

Joined: Oct 31, 2005
Posts: 389
Thanks Ulf.

Which version of Apache Axis is recommended to use? I see a lot of books written for the previous versions of Axis? Should I download Axis 1.2 or Axis 2?

-- Srikanth
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39535
    
  27
If you have no legacy code, then you should use Axis2. It implements the JAX-WS API instead of the obsolete JAX-RPC, amongst other benefits.
Srikanth Raghavan
Ranch Hand

Joined: Oct 31, 2005
Posts: 389
Thank you Ulf!

Installing Axis2 within tomcat 5 but having some problems. Troubleshooting it... Trying to get it up...

Thanks
-- Srikanth
Raghav Mathur
Ranch Hand

Joined: Jan 12, 2001
Posts: 641
Does this means that a pojo/ejb can be created from a WSDL which acts a webservice ?


Given the WSDL, it takes very little time to create a working client, since most WS engine come with tools that will generate the necessary Java classes for you (e.g., Axis comes with a tool called 'wsdl2java'). You won't have learned much by using the tool, but you'll have a working client.

[ June 11, 2007: Message edited by: Raghav Mathur ]

Raghav.
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2906
Originally posted by Raghav Mathur:
Does this means that a pojo/ejb can be created from a WSDL which acts a webservice ?


  • POJO - Plain Old Java Object. As most of the code generated by the WSDL2Java tool depends heavily on the underlying libraries of the web services framework/SOAP Stack - so most of these objects do not classify as POJOS.
  • EJB - I'm not aware that there are tools that create EJBs from WSDLs - also I would question their overall utility if they did exist. Some container vendors will let you expose an SLSB as a web service - that is part of the J2EE specification. However not every SLSB is a good candidate for being exposed as a web service (the minority would be).

  • However the tool can generate an object-based interface (in the broader sense) for you. However you need to understand that the WSDL describes the request messages that the web service accepts and the response messages that the web service replies with. The messages are purely a "data layout". Objects have behavior in addition to their state (data). There is no description of "behavior" in the WSDL. Also a web service isn't a remote object that provides remote/distributed "object behavior" for you - a good web service is an entire service application that can encapsulate entire business processes. The object representation of the data that is exchanged between the client and the service will often be different on both sides - this is why document oriented web services usually have a separate binding layer that lets you declaratively or programmatically configure how your objects are marshalled to the outgoing XML documents and how incoming XML documents are unmarshalled to your objects.


    "Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
    Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
    Raghav Mathur
    Ranch Hand

    Joined: Jan 12, 2001
    Posts: 641
    Peer -

    When and how does the WSDL come into picture. I understand that there are tools available to transform the contract into client object like xmlbeans as ulf mentioned.

    What other purpose the WSDL have?
    How does a web service and client abide by the contract/wsdl?
    What if we do not have a wsdl in place?
    Ulf Dittmer
    Marshal

    Joined: Mar 22, 2005
    Posts: 39535
        
      27
    Originally posted by Raghav Mathur:
    When and how does the WSDL come into picture. I understand that there are tools available to transform the contract into client object like xmlbeans as ulf mentioned.

    What other purpose the WSDL have?
    How does a web service and client abide by the contract/wsdl?
    What if we do not have a wsdl in place?


    XMLBeans does something completely different than the tools I mentioned (which was Axis' wsdl2java and similar tools).

    A WS naturally conforms to the WSDL it exposes. A client conforms to the WSDL by using it to access the WS (or to generate the classes accessing the WS).

    A WSDL description is not necessary to use a WS, but quite helpful.
    Peer Reynders
    Bartender

    Joined: Aug 19, 2005
    Posts: 2906
    Originally posted by Raghav Mathur:
    When and how does the WSDL come into picture.

    The WSDL (Web Services Description Language) file describes the messaging interface (interface in the general sense) of the web service. It is an interface description.

    I understand that there are tools available to transform the contract into client object

    A tool like WSDL2Java creates an object-based representation, an API if you will, of the messaging interface described in the WSDL.

    What other purpose the WSDL have?

    What other purpose does it need? Its an interface description which can also bind the defined endpoints to URLs.

    How does a web service and client abide by the contract/wsdl?

    Not really sure what you are asking here. The web service will only serve requests that comply with the indicated message definitions in the associated WSDL.

    What if we do not have a wsdl in place?

    Then you must take an alternate route for communicating the web services interface. In that case WSDL2Java tools cannot help you unless you create a WSDL from the information that you have. However if the Web Service cannot be described in WSDL you'll most likely end up writing all the code for creating requests and parsing responses yourself.
    Michael Finney
    Ranch Hand

    Joined: Jan 25, 1999
    Posts: 508
    Originally posted by Ulf Dittmer:
    If you have no legacy code, then you should use Axis2. It implements the JAX-WS API instead of the obsolete JAX-RPC, amongst other benefits.


    The article "Introducing Axis 2, the Next Generation of the Apache Web Service Stack" located at
    http://www.developer.com/services/article.php/3525481
    says on page 2 "Axis gained its current stable state over a long period of time. It will take time until Axis 2 enjoy the same."

    The author makes it sound like Axis 2 is not stable yet. However, the author also only seems to raise the flag of caution in the context of migration.

    Now looking at http://ws.apache.org/axis2/download.cgi we see 2 years of releases have happened.

    Is it soup yet? Is it stable or not?


    Michael Finney - "Always Striving To Serve You Better Every Day"
    http://www.smilingsoftwaresolutions.com/
    Ulf Dittmer
    Marshal

    Joined: Mar 22, 2005
    Posts: 39535
        
      27
    The author makes it sound like Axis 2 is not stable yet.

    The article doesn't have a date on it, but anything "introducing axis2" would have to be a couple of years old. I'd say that by now, yes, Axis 2 is stable, and its built-in support for JAX-WS and WS-Security make it much to be preferred over Axis 1. Can't speak about performance, but that, too, is supposed to be improved.
    Michael Finney
    Ranch Hand

    Joined: Jan 25, 1999
    Posts: 508
    Thanks!
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Beginning Web Services
     
    Similar Threads
    My personal test review about SCDJWS 5 beta
    Wicket, the big door for Java developers
    Passed SCJWS
    Few questions for Ray
    Writing webservices clients from wsdl files