I deleted the path in RuntimeComponentImpl.getServiceReference() that deals
with implementation.composite specially and everything then worked as
expected.  It found the outer component's service, the endpoint, and the
right binding (binding.sca).  My guess is this logic relates to the Tuscany
1.x design where IIRC the promoted services were anchored with the
implementing component.  I tried looking at the SVN history and the logic
(which was in NodeImpl) goes back at least to 2008.  Anyway I opened
TUSCANY-3904 and submitted a patch.

On Tue, Jul 26, 2011 at 10:35 AM, ant elder <ant.el...@gmail.com> wrote:

> On Mon, Jul 25, 2011 at 4:21 PM, Greg Dritschler
> <greg.dritsch...@gmail.com> wrote:
> > I have a question about how SCAClientFactory.getService() deals with a
> > promoted service.
> > Let's say I have composite A with component C1
> >     <component name="C1">
> >         <implementation.composite name="B"/>
> >         <service name="S1Promoted">
> >             <binding.sca name="myscabinding"/>
> >         </service>
> >     </component>
> > and composite B with component C2
> >     <service name="S1Promoted" promote="C2"/>
> >     <component name="C2">
> >         <implementation.java class="..."/>
> >         <service name="S1">
> >             <binding.ws/>
> >         </service>
> >     </component>
> > When I use SCAClientFactory.getService("C1/S1Promoted/myscabinding") to
> > obtain the service, the invocation uses binding.ws, not binding.sca.
> > RuntimeComponentImpl.getServiceReference(Class<B> businessInterface,
> String
> > serviceName) checks for
> > implementation.composite and then uses the component context of the
> promoted
> > component to create a self-reference.
> > ComponentContextImpl.getEndpoint(ComponentService service, String
> > bindingName) searches for the endpoint in the promoted component's
> context.
> >  It has a check for binding name, but if it can't find a match, logic
> added
> > by TUSCANY-3543 just picks the first endpoint.
> > This doesn't sound correct to me.  It certainly seems wrong to ignore the
> > explicit binding name and pick something else.  But even I left out the
> > binding name and just asked for "C1/S1Promoted", I would expect
> binding.sca
> > to be used since that's the binding that's defined for that component
> > service.
> > Greg
>
> Yep i  agree, it doesn't seem right in either of those cases to be
> using binding.ws.
>
>   ...ant
>

Reply via email to