aspose file tools*
The moose likes Web Services and the fly likes How to make the WSDL URL configurable? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "How to make the WSDL URL configurable?" Watch "How to make the WSDL URL configurable?" New topic
Author

How to make the WSDL URL configurable?

Yogesh Gandhi
Ranch Hand

Joined: Dec 05, 2008
Posts: 207
Hey guys,

I have a requirement where in client wants that the WSDL location should be configurable in the client's code.

I have generated clients code from the WSDL and it generates the client code something like the following

@WebServiceRef(wsdlLocation="http://localhost:8080/helloservice/hello?wsdl")
static HelloService service;

But the requirement is that this URL should be configurable and cannot be hard-coded.

Can you please suggest a way how can I do this?

Regards
Yogesh


Roger Sterling
Ranch Hand

Joined: Apr 06, 2012
Posts: 426

setEndPointreference( ... ) will set the specific endpoint you want. new QName( ... ) will set the namespace and expose the path-to-service property. You may benefit by doing more in-depth reading of the Axis documentation.
Yogesh Gandhi
Ranch Hand

Joined: Dec 05, 2008
Posts: 207
Hi,

Here is the detail of my setup.

I generated stubs from WSDL using JDev 11g.

As specified earlier, the WSDL URL is being hard-coded in the generated stubs in the annotations as well. Due to this reason I am not able to set the WSDL path at run-time.

Here is the constructor of the class




This wsdlLocationURL is a private static URL member variable of the class, which we can definitely set at run time.

So, do you mean to say, that the URL given in the annotations as follows, doesn't impact it?



Someone is talking about Dynamic Proxy here. Do you have any clue about what it is ?


http://www.oracle.com/technetwork/articles/javaee/j2ee-ws-140408.html

Roger Sterling
Ranch Hand

Joined: Apr 06, 2012
Posts: 426

The @WebServiceClient annotation sets only the default values. You can override these values at runtime. You can read information from a properties file and use that information as the input to the function calls I mentioned earlier to set the override values.

Dynamic proxy is something totally different. Don't get confused.
Yogesh Gandhi
Ranch Hand

Joined: Dec 05, 2008
Posts: 207
Thanks a lot man. I am glad to know that there WSDL URL can be set at runtime.

This answer of yours solves one of my biggest hurdles.

Thanks again.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to make the WSDL URL configurable?