cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sergey.beryoz...@iona.com>
Subject Re: [DOSGI] how to add properties to AegisContext statically?
Date Thu, 16 Jul 2009 14:56:17 GMT

Hi,

I meant including an aegis xml mappings file with the service bundle, please
see "XML Mapping files" at

http://cwiki.apache.org/CXF20DOC/aegis-21.html

cheers, Sergey


ahmed.aadel wrote:
> 
> Hi,
> 
> Thank you  Sergey.  Could you please elaborate on how "Aegis configuration 
> file as a class resource" could be done in an OSGi environment?  Is there 
> a DOSGi  service to hooklisten to, for example, for further config 
> customization? 
> I appended this to the DOSGi DSW META-INF/cxf/cxf.xml (actually, I don't 
> know which file of  META-INF/cxf/*.xml is the good one to append to, if 
> any!)
> 
> <bean id="aegisContext" class="org.apache.cxf.aegis.AegisContext" 
>         scope="prototype"> 
>         <property name="writeXsiType" 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> 
> 
> It didn't work. 
> I see there is  already static configuration properties for databingding 
> themselves, wouldn't be simpler to push this further and let us add more 
> specific properties that a databinding might need. For example when the 
> WS_DATABINDING_PROP_KEY maps to  an aegis then expect some extra 
> properties like (rootClasses |  writeXsiTypes | beanImplementationMap ) to 
> be set.  Or having extra configuration file in OSGI-INF under the 
> concerned service itself  !?
> 
> Many thanks. 
> 
> 
> 
> From:
> "Sergey Beryozkin" <sberyozk@progress.com>
> To:
> <users@cxf.apache.org>
> Date:
> 16-07-2009 11:03
> Subject:
> Re: [DOSGI]  how to add properties to  AegisContext statically?
> 
> 
> 
> Hi,
> 
> As far as I understand you can have some Aegis configuration file as a 
> class resource, so if it is the case then you might want to 
> jar it with your bundle and it should work...
> Benson can you help please with some advice here ?
> 
> Cheers, Sergey
> 
> ----- Original Message ----- 
> From: <ahmed.aadel@remainsoftware.com>
> To: <users@cxf.apache.org>
> Sent: Wednesday, July 15, 2009 2:01 PM
> Subject: [DOSGI] how to add properties to AegisContext statically?
> 
> 
>> 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 :)
>> 
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-DOSGI---how-to-add-properties-to--AegisContext-statically--tp24497508p24518043.html
Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message