You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Nicolasj <nj...@temenos.com> on 2006/03/24 11:34:38 UTC

get Context from Pojo Webservice

Hi, 
I'm using a Pojo WS using annotation based on the soap-binding sample.

All the deployement is working nicely and I can acces to my WS.
Now, from my Pojo class I would like to create and send a message to another
component registered in servicemix.
How could I get the "ComponentContext" and where should I define the
destinationService for my Pojo class ?

Thanks in advance,

Nicolas
--
View this message in context: http://www.nabble.com/get-Context-from-Pojo-Webservice-t1335655.html#a3568806
Sent from the ServiceMix - User forum at Nabble.com.


Re: get Context from Pojo Webservice

Posted by Guillaume Nodet <gn...@gmail.com>.
You have to set it on the exchange before sending using one of
   exchange.setService(...)
   exchange.setInterfaceName(..)
   exchange.setEndpoint(...)
If you want your POJO to be less tied to the target service, you can
use a dummy interface name / endpoint and define a service connection
on the jbi descriptor of the service assembly.  It will redirect any
exchange send to the configured interface / endpoint to the real
target endpoint.

Cheers,
Guillaume Nodet

On 3/24/06, Nicolasj <nj...@temenos.com> wrote:
>
> Thanks Guillaume for your quick answer.
>
> effectively it's working great with the setContext method.
>
> When I create a Message exchange I do not have any route for this message
> exchange (which is correct as I've not defined it ;-)
>
> How could I defined the "destinationService" in my xbean.xml ?
>  I looked at the "servicemix-jsr181-3.0-SNAPSHOT.xsd" but didn't found any
> clue !
>
> Thanks,
>
> Nicolas
> --
> View this message in context: http://www.nabble.com/get-Context-from-Pojo-Webservice-t1335655.html#a3569342
> Sent from the ServiceMix - User forum at Nabble.com.
>
>

Re: get Context from Pojo Webservice

Posted by Nicolasj <nj...@temenos.com>.
Thanks Guillaume for your quick answer.

effectively it's working great with the setContext method. 

When I create a Message exchange I do not have any route for this message
exchange (which is correct as I've not defined it ;-)

How could I defined the "destinationService" in my xbean.xml ?
 I looked at the "servicemix-jsr181-3.0-SNAPSHOT.xsd" but didn't found any
clue !

Thanks,

Nicolas
--
View this message in context: http://www.nabble.com/get-Context-from-Pojo-Webservice-t1335655.html#a3569342
Sent from the ServiceMix - User forum at Nabble.com.


Re: get Context from Pojo Webservice

Posted by Guillaume Nodet <gn...@gmail.com>.
See
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-jsr181/src/test/resources/proxy/xbean.xml?revision=432892&view=markup

On 8/29/06, Mukesh Mediratta <me...@mail.nih.gov> wrote:
>
>
> I am trying to follow this example to set the context.. and failing.. is
> there a complete example on setting the context.
>
> <jsr181:endpoint ...>
>   <jsr181:pojo>
>     <bean class="xxx">
>       <property name="context" ref="context" />
>     </bean>
>   </jsr181:pojo>
> </jsr181:endpoint>
>
>
>
>
>
> gnodet wrote:
> >
> > Just add a the following lines in your POJO:
> >     public void setContext(ComponentContext context) {
> >         ...
> >     }
> > The method will be called by the component when the service unit is
> > started :)
> >
> > Cheers,
> > Guillaume Nodet
> >
> > On 3/24/06, Nicolasj <nj...@temenos.com> wrote:
> >>
> >> Hi,
> >> I'm using a Pojo WS using annotation based on the soap-binding sample.
> >>
> >> All the deployement is working nicely and I can acces to my WS.
> >> Now, from my Pojo class I would like to create and send a message to
> >> another
> >> component registered in servicemix.
> >> How could I get the "ComponentContext" and where should I define the
> >> destinationService for my Pojo class ?
> >>
> >> Thanks in advance,
> >>
> >> Nicolas
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/get-Context-from-Pojo-Webservice-t1335655.html#a3568806
> >> Sent from the ServiceMix - User forum at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/get-Context-from-Pojo-Webservice-tf1335655.html#a6048587
> Sent from the ServiceMix - User forum at Nabble.com.
>
>


-- 
Cheers,
Guillaume Nodet

Re: get Context from Pojo Webservice

Posted by Mukesh Mediratta <me...@mail.nih.gov>.
I am trying to follow this example to set the context.. and failing.. is
there a complete example on setting the context.

<jsr181:endpoint ...>
  <jsr181:pojo>
    <bean class="xxx">
      <property name="context" ref="context" />
    </bean>
  </jsr181:pojo>
</jsr181:endpoint>





gnodet wrote:
> 
> Just add a the following lines in your POJO:
>     public void setContext(ComponentContext context) {
>         ...
>     }
> The method will be called by the component when the service unit is
> started :)
> 
> Cheers,
> Guillaume Nodet
> 
> On 3/24/06, Nicolasj <nj...@temenos.com> wrote:
>>
>> Hi,
>> I'm using a Pojo WS using annotation based on the soap-binding sample.
>>
>> All the deployement is working nicely and I can acces to my WS.
>> Now, from my Pojo class I would like to create and send a message to
>> another
>> component registered in servicemix.
>> How could I get the "ComponentContext" and where should I define the
>> destinationService for my Pojo class ?
>>
>> Thanks in advance,
>>
>> Nicolas
>> --
>> View this message in context:
>> http://www.nabble.com/get-Context-from-Pojo-Webservice-t1335655.html#a3568806
>> Sent from the ServiceMix - User forum at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/get-Context-from-Pojo-Webservice-tf1335655.html#a6048587
Sent from the ServiceMix - User forum at Nabble.com.


Re: get Context from Pojo Webservice

Posted by Guillaume Nodet <gn...@gmail.com>.
Just add a the following lines in your POJO:
    public void setContext(ComponentContext context) {
        ...
    }
The method will be called by the component when the service unit is started :)

Cheers,
Guillaume Nodet

On 3/24/06, Nicolasj <nj...@temenos.com> wrote:
>
> Hi,
> I'm using a Pojo WS using annotation based on the soap-binding sample.
>
> All the deployement is working nicely and I can acces to my WS.
> Now, from my Pojo class I would like to create and send a message to another
> component registered in servicemix.
> How could I get the "ComponentContext" and where should I define the
> destinationService for my Pojo class ?
>
> Thanks in advance,
>
> Nicolas
> --
> View this message in context: http://www.nabble.com/get-Context-from-Pojo-Webservice-t1335655.html#a3568806
> Sent from the ServiceMix - User forum at Nabble.com.
>
>