It seems like your POJO has been written to work in the lightweight container.
The jsr181 works a bit differently and the init method will not be called.
However, if you add  a method
    public void setContent(ComponentContext context)
it should be called and you would be able to use it to send exchanges.

On 9/26/07, Abdeslam El Abbassi <[EMAIL PROTECTED]> wrote:
> for more information here my pojo code
>
>
> public class ws_messagingImpl implements Messaging, ComponentLifeCycle,
> MessageExchangeListener {
>     private static final Log log =
> LogFactory.getLog(ws_messagingImpl.class);
>
>     private ComponentContext context;
>     private ObjectName extensionMBeanName;
>     public ObjectName getExtensionMBeanName() { return extensionMBeanName; }
>
>     public void init(ComponentContext context) throws JBIException {
>         this.context = context;
>     }
>
>     public void shutDown() throws JBIException {   }
>     public void start() throws JBIException {  }
>     public void stop() throws JBIException {  }
>
>     public void onMessageExchange(MessageExchange exchange) throws
> MessagingException {
>         NormalizedMessage message = exchange.getMessage("in");
>         exchange.setStatus(ExchangeStatus.DONE);
>         context.getDeliveryChannel().send(exchange);
>     }
>
>
>     public void setExtensionMBeanName(ObjectName extensionMBeanName) {
>         this.extensionMBeanName = extensionMBeanName;
>     }
>
>             public MessagingResponse getMessaging(Tocata tocata)     {
>
>                         MessagingResponse oMessagingResponse = new
> MessagingResponse();
>                         oMessagingResponse.setResponseDetails("Message");
>                         oMessagingResponse.setCodeRetour("200");
>
>                         ServiceMixClient client = new
> ServiceMixClientFacade(this.context);
>                 try {
>
>                                 InOnly exchange =
> client.createInOnlyExchange();
>                                                 NormalizedMessage
> message = exchange.getInMessage();
>
> message.setProperty("name", "James");
>                                                 message.setContent(new
> StreamSource(new StringReader("<hello>world</hello>")));
>                                                 QName service = new
> QName("http://servicemix.org/cheese/";, "receiver");
>                                               exchange.setService(service);
>
> client.send(exchange);
>
>                         }
>                 catch (JBIException e) { e.printStackTrace(); }
>
>                         return oMessagingResponse;
>
>                     }
>
> }
>
>
>
> And the error :
>
> Caused by: java.lang.NullPointerException
>     at
> org.apache.servicemix.client.ServiceMixClientFacade.createInOnlyExchange(ServiceMixClientFacade.java:84)
>     at
> com.thales.eai.ws_messaging.ws_messagingImpl.getMessaging(ws_messagingImpl.java:147)
>
> Thank to resolve my problem
>
>
> Abdeslam El Abbassi a écrit :
> > Hi,
> > i have problem to route message from a jsr pojo.
> > Where to do the route and how ? wich components to use ? PojoReceiver ?
> >
> > Thanks for your response.
> >
> > Abdeslam
> >
> >
> > here some code
> > -------------------------- http su :
> >
> > <beans xmlns:http="http://servicemix.apache.org/http/1.0";
> >        xmlns:ws_messaging="urn:com:thales:eai:ws_messaging">
> >
> >   <http:endpoint service="ws_messaging:MessagingService"
> > endpoint="MessagingPort"
> >                                                               
> > interfaceName="Messaging"
> >                                                               
> > role="consumer"
> >                   locationURI="http://localhost:8192/MessagingService/";
> >                                                       
> > defaultMep="http://www.w3.org/2004/08/wsdl/in-out";
> >                   defaultOperation="getMessaging"
> >                                                       soap="true"
> >                                                       
> > targetService="ws_messaging:MessagingService" />
> > </beans>
> > --------------------------
> >
> >
> > -----------------------jsr su -------------------------
> > <jsr181:endpoint
> >       endpoint="MessagingPort"
> >               typeMapping="xmlbeans"
> >                       wsdlResource="classpath:ws_messaging.wsdl">
> >                                       <jsr181:pojo>
> >                                                       <bean 
> > class="com.thales.eai.ws_messaging.ws_messagingImpl" />
> >                                       </jsr181:pojo>
> > </jsr181:endpoint>
> >
> >
> >
>


-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Reply via email to