This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Services and the fly likes Dynamically publish webservice on different urls Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Dynamically publish webservice on different urls" Watch "Dynamically publish webservice on different urls" New topic
Author

Dynamically publish webservice on different urls

francesco umani
Greenhorn

Joined: Aug 07, 2013
Posts: 27
Hi all.

I have this scenario:

In a message exchange protocol, I need to expose the same Webservice through different URLs.

Suppose I've a webservice published on http//localhost/Webservice and http//localhost/Webservice2.

A user, through a configuration console, can add a new endpoint URL, and programmatically a new webservice instance has to be published to that URL to catch incoming messages.

Is there any way to accomplish this? I have a Glassfish 3 Application server and I'd like if the webservice expose could use the application context for transactional operation and so on.

Regards.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12759
    
    5
This sounds like a REST architecture where all requests go through a root servlet and get handled according to the remainder of the URL.

Bill
francesco umani
Greenhorn

Joined: Aug 07, 2013
Posts: 27
The webservice exposed as to be a soap one accordingly to a standard fixed xsd and operation.
Depending on the invocated URL some parameters are detected.

EX. If I receive a message on http//localhost/Webservice I know that the invoker is invoker1 (simplifying).


William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12759
    
    5
A user, through a configuration console, can add a new endpoint URL, and programmatically a new webservice instance has to be published to that URL to catch incoming messages.


So you want a client to be able to start an entirely new SOAP message handler at a new arbitrary address!

I would say it is time to drop back to the 10,000 meter view and go for a new architecture.

Bill
francesco umani
Greenhorn

Joined: Aug 07, 2013
Posts: 27
William Brogden wrote:
So you want a client to be able to start an entirely new SOAP message handler at a new arbitrary address!


It's the specific .
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12759
    
    5
Where does the code for this new SOAP message handler come from?

Bill
francesco umani
Greenhorn

Joined: Aug 07, 2013
Posts: 27
In what a sense? In the current realization, a pojo read the configuration from a database and lunch a thread for each webservice exposing a new endpoint (the website is always the same, what is changing is only the webserver name and tcp port).
What i'd like to do is us an application server glassfish to do some similar, for example instantiating a new session bean for each endpoint.

Thanks again.

William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12759
    
    5
Sorry if I am a little slow, but I am still trying to figure out what is different about these custom webservices that the client can request.

It sounds like a RESTful architecture because the URL designates a resource, but apparently the resource is a named SOAP message handler.

A "root" servlet that gets all requests could look at the URL and decide if it already knows this name - if so locate instance of the SOAP handler and forward the request and response objects. If it does not recognize the name, create a new instance (with some custom parameters?), remember the name and instance, and forward the request and response.

Bill
francesco umani
Greenhorn

Joined: Aug 07, 2013
Posts: 27
No problem, It's me. My English is poor and I can't exlpain the problem very well, so thanks for the effort.

What I'm doing is:

1) read the configuration from a database (where the user enter the endpoints needed for accept incoming messages)
2) foreach endpoint needed, istantiate a new javax.xml.ws.Endpoint with Endpoint.create(SOAPBinding.SOAP11HTTP_BINDING, implementator);
implementor is a @WebService annotated java class corresponding to the wsdl I want to expose, initialized through an init(Configuration configurationFromPoint1)
3) publish the endpoint calling e.publish("DESIDERED URL READ FROM POINT 1)");
4) when the webservice receive a message (the client call the webservice) the webservice store the message and the parameters stored in configuration.

All this work but in a J2SE6 environment.
I'm wandering how to realize the same in a J2EE environment using JTA, JPA, EJBs and so on...

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Dynamically publish webservice on different urls
 
Similar Threads
Call Webservice methods from the URL addresss
WebService terminologies
EJB & Webservice
Strange problem | Cant load WSDL on explorer | Axis 2 + Helios + jboss-5.1.0.GA-jdk6
Web Page query