On Thursday 02 December 2010 4:35:05 am Andrew Dinn wrote:
> On 12/01/2010 09:32 PM, Daniel Kulp wrote:
> > If you have the WebServiceContext injected, just call:
> > 
> > context.getEndpointReference()
> > 
> > and that should be it.
> 
> That's all very well if something can be convinced to invoke the service
> first. But this is a chicken and egg situation. What can you do if e.g.
> service A wants to initiate communication with service B and send a
> message containing an EPR for A so that B can call back to A later.
> 
> This is a problem I faced when implementing the WSTX standard and I
> could not work out how to resolve it using the method you describe. In
> the end  I had to use an EPRBuilder and code up the EPR address using
> properties configured on the service deployment.

Well, if you can get a handle to the javax.xml.ws.Endpoint that represents the 
service, then you just need to call endpoint.getEndpointReference();   Kind 
of.  When running in a Servlet, that CAN be problematic as we don't know the 
context and path and such until the first hit.  Thus, prior to the first hit, 
that endpoint address might not be completely valid.

For the most part, if you are using an embedded Jetty thing, you can just do 
something like:

Endpoint ep = Endpoint.publish("http:///.....";, myImpl);
ep.getEndpointReference();
to get the EPR to pass around.

If using Spring and you use a "jaxws:endpoint" element to define the endpoint, 
the jaxws:endpoint maps directly to a javax.xml.ws.Endpoint object.   You can 
just lookup the been by ID from the context and cast to the Endpoint.



-- 
Daniel Kulp
[email protected]
http://dankulp.com/blog

Reply via email to