Agreed. I will submit a patch for this.
________________________________________
From: Daniel Kulp [[email protected]]
Sent: Wednesday, May 26, 2010 12:29 PM
To: [email protected]
Cc: Glen Mazza
Subject: Re: jaxws:endpoint address not used when using createdFromAPI
On Wednesday 26 May 2010 12:15:56 pm Glen Mazza wrote:
> dkulp wrote:
> > On Wednesday 26 May 2010 4:18:25 am Seumas Soltysik wrote:
> >> If I call Enpoint.publish(address, implementation) and define a
> >>
> >> <jaxws:endpoint> like this:
> >> <jaxws:endpoint
> >>
> >> name="{http://ws.iona.com/peer_manager}PeerManagerPort"
> >> address="http://localhost:8888/services/PeerManagerService"
> >>
> >> wsdlLocation="./wsdl/peer-manager.wsdl"
> >> createdFromAPI="true"
> >> endpointName="ns:PeerManagerPort"
> >> serviceName="ns:PeerManagerService"
> >> xmlns:ns="http://ws.iona.com/peer_manager"/>
> >>
> >> the address attribute is not used by the EndpointImpl class. In
> >> EndpointImpl.getServer(), the address is read from the configuration and
> >> set on the endpoint but it is never used. The address from
> >> Endpoint.publish(address, implementation) always over-rides the address
> >> in
> >> the configuration. This pretty much makes sense since if you
> >> specifically specify an address then that is the address that should be
> >> used as opposed
> >> to the address in configuration. However, it seems to me that if you
> >> pass in and empty string or a null value and the configuration for the
> >> <jaxws:endpoint> contains an address attribute, then that address
> >> attribute should be used. Why is this not the case?
> >
> > I'd probably consider that a bug. If the passed in address is null,
> > pulling
> > it from the config definitely makes sense.
>
> Probably, but I wouldn't say "definitely". The fact that the developer
> used Endpoint.publish(address, implementation) instead of
> Endpoint.publish(implementation) indicates the developer specifically
> wanted to override the address from what's in the default configuration
> but that he goofed up and made an error in his setting of the address
> property. If that's the majority scenario, we would be doing the
> developer a favor in not relying on the config file value--instead having
> CXF return an error and alerting the developer to his mistake.
Well, "Endpoint.publish(implementation)" doesn't exist. It's a not static
method and the Object it takes is an undefined contextual object, not the
implementor. All of the "publish" methods take either a String URL or the
impl specific context object. Thus, the only way to say "use config" is
a null string or possibly some "special" string. I kind of prefer the null
string. :-)
--
Daniel Kulp
[email protected]
http://dankulp.com/blog