Hi,
In our osgi application, we are using DSGi 1.1 Snapshot  for both osgi 
distribution and discovery (the dosgi/zooKeeper based one).  We're facing 
the following problem:
we are getting this kind of exception at the service consumer side:

 org.apache.cxf.aegis.DatabindingException: Could not determine how to 
read type:

it seems  Aegis data binding seems handling de/serialization pretty well 
as long as all needed types are present in the wsdl. But this is not alwys 
the case for osgi services as the interface is the contract and concrete 
classes don't have to be specified in the contract.
I read you can feed the AegisContext with properties [rootClasses | 
writeXsiTypes | beanImplementationMap ] to help aegis binding 
additional/concrete types. 

I tried to set some of those properties adding something like this:

<bean id="aegisContext" class="org.apache.cxf.aegis.AegisContext"
        scope="prototype">
        <property name="writeXsiTypes" value="true" />
        <property name="rootClassNames">
            <list>
                <value><some class1></value>
                <value><some class2></value>
            </list>
        </property>
    </bean>

    <bean id="dataBinding" 
class="org.apache.cxf.aegis.databinding.AegisDatabinding"
        scope="prototype">
        <property name="aegisContext" ref="aegisContext" />
    </bean> 

but I think this may work when creating directly your cxf/web services 
client-server beans... as  you still have the flexibility to configure 
them at your like.

I debugged AegisDatabinding class to configure out how those (for 
compatibility but deprecated!) properties are set in the ServiceImpl class 
but it seems they are never set anywhere.

 public void initialize(Service s) {
...
  Object val = s.get(READ_XSI_TYPE_KEY);
            if ("false".equals(val) || Boolean.FALSE.equals(val)) {
                aegisContext.setReadXsiTypes(false);
            }

            val = s.get(WRITE_XSI_TYPE_KEY);
            if ("true".equals(val) || Boolean.TRUE.equals(val)) {
                aegisContext.setWriteXsiTypes(true);
            }

            val = s.get(OVERRIDE_TYPES_KEY);
            if (val != null) {
                Collection nameCollection = (Collection)val;
                Collection<String> typeNames = 
CastUtils.cast(nameCollection, String.class);
                if (overrideTypes == null) {
                    overrideTypes = new HashSet<String>();
                }
                overrideTypes.addAll(typeNames);
            }
...


Does somebody know  how to add properties to  AegisContext statically via 
xml or service properties? is there better way (more osgi-ish :) to handle 
implementation and extra types that are not visible via wsdl?
Any help please !
Many thanks :)

Reply via email to