You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by "Glynn, Eoghan" <eo...@iona.com> on 2007/05/15 16:22:47 UTC

Feature with a child element


Folks,

I bet I'm doing dumb here that'll be immediately obvious to the Spring
gurus ...

Within a feature, I want to have a child element that references another
bean. So that the config looks something like:

<jaxws:client id="myPort" createdFromAPI="true">
    <jaxws:features>
        <myNS:myFeature myAttribute="value">
            <myNS:myChild>
                <ref bean="myOtherBean"/>
            </myNS:myChild>
        </myNS:myFeature>
    </jaxws:features>
</jaxws:client>

Now having an attribute on the feature is no problem, the corresponding
call to MyFeaure.setMyAttribute() occurs as expected.

However, I'm not seeing a call to MyFeaure.setMyChild(), so what do I
need to do in order to have the bean injection occur for the myChild
element? Do I need to do some custom parsing in the
MyFeatureBeanDefinitionParser, or wire in a schema or some-such?

Cheers,
Eoghan


RE: Feature with a child element

Posted by "Glynn, Eoghan" <eo...@iona.com>.
Thanks Andrea,

Walking the list of child nodes of the feature, then calling
setFirstChildAsProperty() on the bean ref element works a treat :)

/Eoghan

> -----Original Message-----
> From: Andrea Smyth [mailto:andrea.smyth@iona.com] 
> Sent: 15 May 2007 16:08
> To: cxf-dev@incubator.apache.org
> Subject: Re: Feature with a child element
> 
> Have your tried using
> AbstractBeanDefinitionParser.setFirstChildAsProperty(...)  
> (from the cxf-common-utilities package) in your 
> MyFeatureBeanDefinitionParser?
> org.apache.cxf.jaxws.spring.EndpointBeanDefinitionParser uses 
> it to deal with child elements named "ref " from the Spring 
> beans namespace.
> 
> Andrea.
> 
> Glynn, Eoghan wrote:
> 
> >Folks,
> >
> >I bet I'm doing dumb here that'll be immediately obvious to 
> the Spring 
> >gurus ...
> >
> >Within a feature, I want to have a child element that references 
> >another bean. So that the config looks something like:
> >
> ><jaxws:client id="myPort" createdFromAPI="true">
> >    <jaxws:features>
> >        <myNS:myFeature myAttribute="value">
> >            <myNS:myChild>
> >                <ref bean="myOtherBean"/>
> >            </myNS:myChild>
> >        </myNS:myFeature>
> >    </jaxws:features>
> ></jaxws:client>
> >
> >Now having an attribute on the feature is no problem, the 
> corresponding 
> >call to MyFeaure.setMyAttribute() occurs as expected.
> >
> >However, I'm not seeing a call to MyFeaure.setMyChild(), so 
> what do I 
> >need to do in order to have the bean injection occur for the myChild 
> >element? Do I need to do some custom parsing in the 
> >MyFeatureBeanDefinitionParser, or wire in a schema or some-such?
> >
> >Cheers,
> >Eoghan
> >
> >  
> >
> 
> 

Re: Feature with a child element

Posted by Andrea Smyth <an...@iona.com>.
Have your tried using 
AbstractBeanDefinitionParser.setFirstChildAsProperty(...)  (from the 
cxf-common-utilities package) in your MyFeatureBeanDefinitionParser?
org.apache.cxf.jaxws.spring.EndpointBeanDefinitionParser uses it to deal 
with child elements named "ref " from the Spring beans namespace.

Andrea.

Glynn, Eoghan wrote:

>Folks,
>
>I bet I'm doing dumb here that'll be immediately obvious to the Spring
>gurus ...
>
>Within a feature, I want to have a child element that references another
>bean. So that the config looks something like:
>
><jaxws:client id="myPort" createdFromAPI="true">
>    <jaxws:features>
>        <myNS:myFeature myAttribute="value">
>            <myNS:myChild>
>                <ref bean="myOtherBean"/>
>            </myNS:myChild>
>        </myNS:myFeature>
>    </jaxws:features>
></jaxws:client>
>
>Now having an attribute on the feature is no problem, the corresponding
>call to MyFeaure.setMyAttribute() occurs as expected.
>
>However, I'm not seeing a call to MyFeaure.setMyChild(), so what do I
>need to do in order to have the bean injection occur for the myChild
>element? Do I need to do some custom parsing in the
>MyFeatureBeanDefinitionParser, or wire in a schema or some-such?
>
>Cheers,
>Eoghan
>
>  
>