You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by "Glynn, Eoghan" <eo...@iona.com> on 2007/04/02 00:06:26 UTC

Question on the simple frontend


Folks,

We're light on system tests and/or samples for the simple frontend, so
here's a dumb question that may well have an obvious answer.

Is it possible to use the ClientProxyFactoryBean to create a client for
*any* suitable endpoint associated with the target service? 

>From a cursory look at the code, it seems the options are either to use
the fallback value of ServiceName+"Port", or to specify an explicit
endpoint name via
ClientProxyFactoryBean.getClientFactoryBean().setEndpointName().

But is there an analogue for the JAX-WS Service.getPort(Class<T> sei)
method, i.e. to retrieve a proxy for any suitable endpoint? [as opposed
to a *specific* endpoint] 

Cheers,
Eoghan

RE: Question on the simple frontend

Posted by "Glynn, Eoghan" <eo...@iona.com>.

>From the JAX-WS spec, [2.1EA3]:

"T getPort(Class<T> sei) Returns a proxy for the specified SEI, the
Service instance is responsible
for selecting the port (protocol binding and endpoint address)."

So I think it would actually be fair to say that a proxy is retrieved
for any suitable endpoint. But lets not get bogged in jesuitical
arguments as to it being the endpoint or the binding that's primarily
being selected. The port implies the binding, so selecting the former
implies the latter, and that's good enough for me.

In our ServiceDelegate impl, if there are multiple suitable endpoints
(i.e. multiple ports associated with the target service), then the impl
happens to choose the first of these. 

The semantics at the WSDL level are as follows:

"If a service has several ports that share a port type, but employ
different bindings or addresses, the ports are alternatives. Each port
provides semantically equivalent behavior (within the transport and
message format limitations imposed by each binding)."

So I believe our ServiceDelegate implementation is free to employ
whatever strategy in choosing between these alternatives. But I don't
think it would be a particularly good strategy to restrict this to the
first HTTP/SOAP endpoint it comes across as you suggest. There may not
even be a HTTP/SOAP port defined in the WSDL (or wherever).

That the simple frontend doesn't have an analogous way for the
application to be non-specific about the endpoint isn't a big issue for
me, but I certainly don't want to restrict the JAX-WS side to fit in
with the simple frontend.

/Eoghan 

> -----Original Message-----
> From: Dan Diephouse [mailto:dan@envoisolutions.com] 
> Sent: 02 April 2007 05:14
> To: cxf-dev@incubator.apache.org
> Subject: Re: Question on the simple frontend
> 
> On 4/1/07, Glynn, Eoghan <eo...@iona.com> wrote:
> >
> >
> >
> > Folks,
> >
> > We're light on system tests and/or samples for the simple 
> frontend, so 
> > here's a dumb question that may well have an obvious answer.
> 
> 
> There are a whole hosts of tests in the aegis module that use 
> the simple frontend. Although they still probably wouldn't 
> explain the answer to your question :-)
> 
> Is it possible to use the ClientProxyFactoryBean to create a 
> client for
> > *any* suitable endpoint associated with the target service?
> >
> > From a cursory look at the code, it seems the options are either to 
> > use the fallback value of ServiceName+"Port", or to specify an 
> > explicit endpoint name via 
> > ClientProxyFactoryBean.getClientFactoryBean().setEndpointName().
> >
> > But is there an analogue for the JAX-WS 
> Service.getPort(Class<T> sei) 
> > method, i.e. to retrieve a proxy for any suitable endpoint? [as 
> > opposed to a *specific* endpoint]
> 
> 
> 
> AFAIK getPort(Class<T> sei) doesn't choose a proxy thats 
> suitable for any endpoint, it chooses a specific binding. 
> From the javadoc:
> 
> """
> The parameter serviceEndpointInterface specifies the service 
> endpoint interface that is supported by the returned proxy. 
> In the implementation of this method, the JAX-WS runtime 
> system takes the responsibility of selecting a protocol 
> binding (and a port) and configuring the proxy accordingly. 
> The returned proxy should not be reconfigured by the client.
> """
> 
> In our implementation we seem to detect the appropriate port 
> by selecting either the only endpoint, or the endpoint which 
> matches the @WebService annotation on the SEI interface. I'm 
> not 100% sure thats correct - is portName even allowed on the 
> SEI? I thought it went on the impl class. If so, maybe a 
> better thing to do would be to find the first HTTP/SOAP 
> endpoint it comes across.
> 
> So in answer to your question, no, the simple frontend does 
> not have that.
> ClientImpl does have autodetection code to select the first 
> SOAP/HTTP binding if you pass it a URL though. This should 
> definitely be added to the ClientProxyFactoryBean though so 
> all the user needs to do is pass in a WSDL and an interface to it.
> 
> - Dan
> --
> Dan Diephouse
> Envoi Solutions
> http://envoisolutions.com | http://netzooid.com/blog
> 

Re: Question on the simple frontend

Posted by Dan Diephouse <da...@envoisolutions.com>.
On 4/1/07, Glynn, Eoghan <eo...@iona.com> wrote:
>
>
>
> Folks,
>
> We're light on system tests and/or samples for the simple frontend, so
> here's a dumb question that may well have an obvious answer.


There are a whole hosts of tests in the aegis module that use the simple
frontend. Although they still probably wouldn't explain the answer to your
question :-)

Is it possible to use the ClientProxyFactoryBean to create a client for
> *any* suitable endpoint associated with the target service?
>
> From a cursory look at the code, it seems the options are either to use
> the fallback value of ServiceName+"Port", or to specify an explicit
> endpoint name via
> ClientProxyFactoryBean.getClientFactoryBean().setEndpointName().
>
> But is there an analogue for the JAX-WS Service.getPort(Class<T> sei)
> method, i.e. to retrieve a proxy for any suitable endpoint? [as opposed
> to a *specific* endpoint]



AFAIK getPort(Class<T> sei) doesn't choose a proxy thats suitable for any
endpoint, it chooses a specific binding. From the javadoc:

"""
The parameter serviceEndpointInterface specifies the service endpoint
interface that is supported by the returned proxy. In the implementation of
this method, the JAX-WS runtime system takes the responsibility of selecting
a protocol binding (and a port) and configuring the proxy accordingly. The
returned proxy should not be reconfigured by the client.
"""

In our implementation we seem to detect the appropriate port by selecting
either the only endpoint, or the endpoint which matches the @WebService
annotation on the SEI interface. I'm not 100% sure thats correct - is
portName even allowed on the SEI? I thought it went on the impl class. If
so, maybe a better thing to do would be to find the first HTTP/SOAP endpoint
it comes across.

So in answer to your question, no, the simple frontend does not have that.
ClientImpl does have autodetection code to select the first SOAP/HTTP
binding if you pass it a URL though. This should definitely be added to the
ClientProxyFactoryBean though so all the user needs to do is pass in a WSDL
and an interface to it.

- Dan
-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog