You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Seumas Soltysik <SS...@progress.com> on 2010/11/15 17:57:24 UTC

Issue with SoapTransportFactory

SoapTransportFactory extends AbstractTransportFactory which contains a protected Bus data member. However, SoapTransportFactory has its own private Bus data member and does not make use of the Bus data member inherited from AbstractTransportFactory. Why is this? Is this done on purpose or is this an oversight?

public class SoapTransportFactory extends AbstractTransportFactory implements DestinationFactory,
    WSDLEndpointFactory, ConduitInitiator {    
    private Bus bus;
}

public abstract class AbstractTransportFactory {
    protected Bus bus;
}

In a testcase that I am developing this has led to problems. If I initialize an instance of SoapTransportFactory using the cxf-extension-soap.xml configuration,  setTransportIDs() is called on the base class AbstractTransportFactory which ultimately calls register() which registers the transport IDs with the bus:

    public final void register() {
        if (null == bus) {
            return;
        }
        if (this instanceof DestinationFactory) {
            DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
            if (null != dfm && getTransportIds() != null) {
                for (String ns : getTransportIds()) {
                    dfm.registerDestinationFactory(ns, (DestinationFactory)this);
                }
            }
        }

However, because AbstractTransportFactory has its own Bus instance, which is not initialized and therefore null, the transport IDs are never registered with the Bus instance that is visible to the SoapTransportFactory. I think this issue has been disguised by the fact that usually SoapTransportFactory is not initialized without initializing other transport factories which do the right thing registering namespaces with the Bus.




Re: Issue with SoapTransportFactory

Posted by Daniel Kulp <dk...@apache.org>.
On Monday 15 November 2010 11:57:24 am Seumas Soltysik wrote:
> SoapTransportFactory extends AbstractTransportFactory which contains a
> protected Bus data member. However, SoapTransportFactory has its own
> private Bus data member and does not make use of the Bus data member
> inherited from AbstractTransportFactory. Why is this? Is this done on
> purpose or is this an oversight?

Looks like an oversight to me.   I'm testing a fix now.

Dan


 
> public class SoapTransportFactory extends AbstractTransportFactory
> implements DestinationFactory, WSDLEndpointFactory, ConduitInitiator {
>     private Bus bus;
> }
> 
> public abstract class AbstractTransportFactory {
>     protected Bus bus;
> }
> 
> In a testcase that I am developing this has led to problems. If I
> initialize an instance of SoapTransportFactory using the
> cxf-extension-soap.xml configuration,  setTransportIDs() is called on the
> base class AbstractTransportFactory which ultimately calls register()
> which registers the transport IDs with the bus:
> 
>     public final void register() {
>         if (null == bus) {
>             return;
>         }
>         if (this instanceof DestinationFactory) {
>             DestinationFactoryManager dfm =
> bus.getExtension(DestinationFactoryManager.class); if (null != dfm &&
> getTransportIds() != null) {
>                 for (String ns : getTransportIds()) {
>                     dfm.registerDestinationFactory(ns,
> (DestinationFactory)this); }
>             }
>         }
> 
> However, because AbstractTransportFactory has its own Bus instance, which
> is not initialized and therefore null, the transport IDs are never
> registered with the Bus instance that is visible to the
> SoapTransportFactory. I think this issue has been disguised by the fact
> that usually SoapTransportFactory is not initialized without initializing
> other transport factories which do the right thing registering namespaces
> with the Bus.

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog