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

Reply via email to