• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JNDI and JAX-WS

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic