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 JNDI and JAX-WS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "JNDI and JAX-WS" Watch "JNDI and JAX-WS" New topic
Author

JNDI and JAX-WS

Chris Hannegan
Greenhorn

Joined: Sep 21, 2006
Posts: 2
Can you tie a JNDI name to a Web Service?

I'm about 4 days in to Web Services using JAX-WS. I created a generic web service and have it deployed successfully on Sun App Server 9.
I created a generic client that calls my web service. I can run it and I get the expected results.

Two things I do not like (I dont like it because i dont understand it yet )
1. The wsdl attribute in the wsimport command. Here's my ANT snippet:
<wsimport sourcedestdir="${dir.wsimport}"
package="my.package.endpoint"
destdir="${dir.classes}"
wsdl="http://localhost:8080/foo/FooService?WSDL"
verbose="${true}">
</wsimport>

When I am building my client, I dont want to build it for DEV while pointing to one server, then build it again when i want to migrate my client to a TEST environment, then build it again when I want to migrate to my PRODUCTION environment.

2. My client java code looks like this:
public class FooClient {
//@WebServiceRef(wsdlLocation = "http://localhost:8080/foo/FooServic?wsdl")
static FooService service;

Again, I have my server name hard-coded. I dont want to recompile everytime I promote my code to a new environment.

According to documentation, you can tie a Web Service to a jndi name and i think i did that successfully. I just dont know how to call it.

@WebServiceRef API mentions that you can supply a JNDI name. However, I cant find any examples of this.

Can it be done?

While typing this...I was beginning to think it was impossible. Simply because you need to find the wsdl definition...and if you're using a jndi name...you still need to list the server that you are using.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JNDI and JAX-WS