Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jax-ws 2.2.1: creating clients for endpoints that are not in the WSDL

 
Joep Availableonrequest
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a setup in which a 'scheduler' sends requests to different webservices. The interfaces for those webservices are the same, although they perform slightly different tasks. I wrote a general wsdl file which I would like to use for all those services. So I use a wsimport to generate a client. All is good so far. I should be able to do something like:



Unfortunately, I cannot find how to just change the url of a webservice. I can give parameters to MyService in the form of a 'wsdl location', a Qname and WebServiceFeatures, but not a different url. If I try to skip the generated MyService class and look in Service.create(), I still can't find the place where to add the new address of the endpoint. I can add 'endpoints' but then I can only make 'Dispatch' objects which seems to operate at a lower lever than I would like. I also couldn't find clues in the source code.

Did I miss something obviouss or is it really not done to use the same WSDL to generate clients for different web-services with the same contract?

Thanks in advance

Joppeknol

 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
You set the BindingProvider.ENDPOINT_ADDRESS_PROPERTY property in the request context prior to sending a request.
The following example shows how to set the property when working with an object implementing the Dispatch interface:

Here is an example how to set this property when working with generated stubs:

Best wishes!
 
Joep Availableonrequest
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ivan Krizsan wrote:


Exactly what I needed. It works. Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic