Many of the superplatforms (IBM Websphere, BEA WebLogic, Oracle Application Server, etc.) have their own Java enterprise specifications compliant web services toolkit. But even within each product line the support varies with the version of the product (which correlates to the level of Java enterprise specifications they comply with). More recent versions of JBoss (4.0.5 and up) support JBossWS. Spring has Spring-WS. However some people prefer to use an independent web services tool like Axis2 or Apache CXF (The ServerSide: Axis, Axis2, and CXF: Surveying the WS Landscape).
Strictly speaking you don't need a web services toolkit to access a web service, you can "simply" write your own SAAJ client (Java Web Services in a Nutshell: Chapter 3 SAAJ (PDF)). However that requires that you interpret the WSDL yourself. That is why most people prefer to use a WSDL-To-Java generation tool that generates static Java stubs from the WSDL. Depending on the web services toolkit that tool may be called wsdl2java, wscompile, wsimport, etc.
"3. WSDL2Java: Generate the Server-side Wrapper Code and Stubs For Easy Client Access" from Creating Web Services with Apache Axis shows an example of the process. However do not misinterpret this as an endorsement to use Axis 1.x. Axis 1.x is based on JAX-RPC, a specification that most likely won't be a required part of the Java Enterprise specification beyond Java EE 5. You're probably better off choosing something that is based on JAX-WS. Know what you are getting in to.
Thank you. The WSDL2Java function worked out excellent! I was able to test the client with the built in test-client and everything that was posted to the Webservice was reflected in the database. Task 1 completed.
Now I do face another problem (or rather a barrier because I lack some basic understanding in this field).
I would like to use the Webservice client from my Java source project (or call it in some way from there). The client is located in my web-project. Any ideas on how to move forward with this?
Did you write a stand-alone Java client and now you would like to access the web service from a web client? The red book also has examples for a "web client". Access from a web client usually is no different than from a stand-alone client. However the application server may let you deploy the client (service) component so that you can access it via JNDI (if you want to).
The test using generated JSPs didn't work out. I tried (with and with out jndi method included) and it gave me the same error as mentioned above.
Only thing that worked was the Web Services explorer tool (relates to figures 15-10 to 15-13) and the Universal Test Client. Both were able to access the webservice without problems. However I can't seem to find any of the code that they have produced...
It seems there is some kind of setting that needs to be changed. Any ideas what kind of setting files the WSDL2client modifies?
The UTC runs fine when the source-files is put and run from the default package. If I move the files to another package and run the UTC from there it generates the same error as above.
I've also seen a class-cast exception when a method is supposed to return a stub and cast it to a object which is implemented by the stub class. This makes me think there must be some kind of setting that has to be tweaked.
FYI I finally got it to work. It had to do with the namespace mapping (which mapped to the default package). I changed this to the desired package and everything worked out fine.
Thanks for your help Peer, I'll probably be back in this forum next time when I'll try to create a JAX-WS webservice... By the way, webservices is great fun, I've enjoyed every step of this learning process.