This discussion is archived
7 Replies Latest reply: Apr 15, 2013 7:26 AM by gimbal2 RSS

Book recommendation?

999817 Newbie
Currently Being Moderated
I certified in Java 12 years ago, but have unfortunately not had the opportunity to use it much since then. (I’ve been programming with PowerBuilder, PHP, and C++ in the meantime.)

I’m trying to develop a SOAP web service using Netbeans and Glassfish. I was given a complex (26 pages, including comments) WSDL, and had the web service skeleton created for me by Netbeans, but I’m not exactly sure where to go from here. I got a trial subscription to the Safari Books website and have been trying to get caught up on Java, but can’t find anything that goes into the detail on JAX-WS and JAXB that I need (at least I think those things are what I’m using).

I did find this, which seems to be exactly what I’m working with (although it’s using different tools), but I’m wondering if there is a good book that covers it in more detail?
http://technicalmumbojumbo.wordpress.com/2012/04/09/web-services-jaxws-weblogic-oracle-enterprise-pack-for-eclipse-oepe-tutorial/

Thanks!

Edited by: 996814 on Mar 28, 2013 9:59 AM
  • 1. Re: Book recommendation?
    jtahlborn Expert
    Currently Being Moderated
    no need for a book:

    http://metro.java.net/guide/
  • 2. Re: Book recommendation?
    gimbal2 Guru
    Currently Being Moderated
    Well you're on your way - JAX-WS is indeed the API you need to do SOAP stuff. An alternative people use is Apache Axis 2, but JAX-WS is convenient because an implementation of it is actually integrated into the JDK. The fact that you're leaning on Netbeans is no good though; you have to learn and understand how the things work, making Netbeans do it for you is going to be incredibly in your way. You can use Netbeans to manage your project, but I would do the JAX-WS stuff by hand, at least the first time around to get used to it. So just create a plain old Java application and try to get your SOAP client stuff to work in that first. Don't dig right into Enterprise applications, get it to work from a plain old java application first.

    The thing about SOAP is that it is a pretty crappy standard to be honest. The fact that you have such a huge WSDL might already pose problems with compatibility depending on what generated that WSDL. Your first step will be to see if you can successfully generate a client from it, using the wsimport tool which is part of your JDK (I would use Java 7 if you weren't already by the way). Then it is a matter of figuring out how to use the generated code. Reading the manual might at this point in time be better than using a book to be honest - JAX-WS is not really brain surgery, you just need to get started with it.

    http://jax-ws.java.net/
  • 3. Re: Book recommendation?
    999817 Newbie
    Currently Being Moderated
    Thanks. I've actually made a much simpler web service before, using PowerBuilder. But I was in control of how the WSDL turned out on that one. With this one, it's a WSDL created by a standards committee. I work for an auto insurance company and I am required by a new state law to have this implemented within a few months so that the state can use the same client to communicate with different web services from all the auto insurance companies that serve our state. PowerBuilder was unable to generate a matching WSDL from the web service it generated, which is why I'm using Java instead (I've already found that the resulting WSDL matches).

    The problem I was having is that all the tutorials I could find told me how to generate the web service, but then just ended with "now implement the generated objects." That's the part I've been stuck on, but I'm gradually getting it figured out. Java is a lot more complicated than it was 12 years ago, and I was hoping to find the magic book that would explain it all for me. :)

    Edited by: 996814 on Mar 29, 2013 7:47 AM

    Edited by: 996814 on Mar 29, 2013 7:49 AM
  • 4. Re: Book recommendation?
    gimbal2 Guru
    Currently Being Moderated
    996814 wrote:
    Thanks. I've actually made a much simpler web service before, using PowerBuilder. But I was in control of how the WSDL turned out on that one. With this one, it's a WSDL created by a standards committee. I work for an auto insurance company and I am required by a new state law to have this implemented within a few months so that the state can use the same client to communicate with different web services from all the auto insurance companies that serve our state. PowerBuilder was unable to generate a matching WSDL from the web service it generated, which is why I'm using Java instead (I've already found that the resulting WSDL matches).
    That is reallly not relevant or necessary to share to be honest.
    The problem I was having is that all the tutorials I could find told me how to generate the web service, but then just ended with "now implement the generated objects."
    That's a problem with tutorials as a whole - they all suck. They tend to be written by novices that after reading a chapter on a book think they're experts and have to share their epic knowledge with the world. Then you get something with only half of the truth in it that lacks all the important nuances.
    That's the part I've been stuck on, but I'm gradually getting it figured out. Java is a lot more complicated than it was 12 years ago, and I was hoping to find the magic book that would explain it all for me. :)
    Its not more complicated. Software engineering as a whole is complicated and stays complicated. The only thing that has changed is that the world wants more more more, so you have to know more more more. But that's your job.
  • 5. Re: Book recommendation?
    999817 Newbie
    Currently Being Moderated
    It's relevant because it tells you some background info, such as why I'm using Java, why I'm using a very complex WSDL, why I'm using SOAP, and why I have no choice on these things.

    The tutorials I was referring to were found on the Eclispse and Netbeans web sites. Rather than being written by novices, I think they were just written by people that are a little too close to the products, and assuming a high level of understanding on their readers' part that isn't necessarily there. The online docs I've been referred to here tend to have the same problem, which is why I was hoping for a good book recommendation. But I'll keep working through them, along with the books I have access to. Thanks for the suggestions.
  • 6. Re: Book recommendation?
    Nico Newbie
    Currently Being Moderated
    Hi, I can tell you the basic steps in building a client with jax-ws using only javaSE (no IDE, no Axis, no Metro). Obviously, an IDE like NetBeans does more or less the same stuff behind the scenes. To follow these steps all that you need is a jdk 6 or 7:

    1 - From the command line run "wsimport -keep -p package.myPackage myWsdl.wsdl" (-keep = keep the java sources, -p = the name of the package for the generated files). This will create all the classes that the client needs.

    2 - Looking at the generated classes, you shuold see an interface with the same name of the portType element in the wsdl and a class that extends javax.xml.ws.Service (in general the name ends with "Service").

    3 - Write a new java class with a main that: 1) Create an object of type Service (you can use the  constructor with no parameters). 2) Call the method getPort on the *Service object which in turn calls the getPort method of javax.xml.ws.Service with the right parameters. This returns an object of type interface on which you can call the ws methods. Java API says: "Service objects provide the client view of a Web service.  The getPort method returns a stub. A service client uses this stub to invoke operations on the target service endpoint." So, the stub is responsible for building the SOAP request using JAXB and firing the http post to the endpoint (or SMTP message or whatever).

    I'm reading "Java web services up and running". It is a good introduction to jax-ws that does not go into all details (300 page). You can find many details in the jax-ws specification (gimbal posted it).

    Edited by: Nico on 16-apr-2013 0.20 (grammar errors)
  • 7. Re: Book recommendation?
    gimbal2 Guru
    Currently Being Moderated
    Nico wrote:
    I'm reading "Java web services up and running". It is a good introduction to jax-ws that does not go into all details (300 page).
    The Amazon user reviews are pretty much slashing this book into pieces though. I would not adopt actual code practices from it if I were you.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points