thanks for the code, but I am wondering what the support and msisdn vars
should be?



bsnyder wrote:
> 
> On 5/16/07, Benamin <[EMAIL PROTECTED]> wrote:
>>
>> I need an SE that can do the following:
>>
>> 1.  It needs to read data from a database (dequeue).
>> 2.  Once read, this data should be sent over http to a web service.
>> 3.  Repeat steps 1 and 2.
>>
>> I have made the SE and an SU for the SE.  I have made an http provider.
>> What I am trying to figure out is where to place the code in the SE to do
>> the the reading of data from the db.  I thought maybe the start method in
>> MyEndpoint.java, but that doesn't seem to work.
> 
> I highly advise you to put your logic in POJOs and then just reference
> the POJOs from within MyEndpoint. This is a best practice that allows
> the logic to be testable outside of JBI/ServiceMix. Then, inside of
> MyEndpoint, you will need to override either processInOnly() or
> processInOutI() depending on the MEP your SE supports - based on what
> you have described you'll need to override processInOut(). In that
> method you will make use of your POJOs.
> 
>> Secondly, I am trying to figure out how to send the data to the http
>> provider.  Are there any code snippets or pseudocode on how to send data
>> from an SE to somewhere else like an http provider?
> 
> Sure, I've done this before. Below is an example of a method to invoke
> a HTTP provider that is a proxy to WSDL web service. the
> invokeIdentityService() method just sends a normalized message to the
> identity service and the HTTP provider BC automatically transforms it
> into SOAP based on the configuration in the HTTP provider BC's
> xbean.xml:
> 
> -------------------------------------------------------------------------------------------------------------------------
> private boolean invokeIdentityService(String msisdn, Source request)
> throws MessagingException {
>         InOut identityExchange = exchangeFactory.createInOutExchange();
>         configureTarget("Identity Service", identityExchange, ctx,
> identityInterface, identityService, identityEndpoint, identityUri);
> 
>         NormalizedMessage in = identityExchange.createMessage();
>         in.setContent(support.createIdentityInMessage(msisdn, request));
>         identityExchange.setInMessage(in);
>         sendSync(identityExchange);
> 
>         NormalizedMessage out = identityExchange.getOutMessage();
>         boolean login = false;
>         if (out != null) {
>             login = support.parseIdentityOutMessage(out.getContent());
>         } else {
>             // TODO: how should we handle faults
>         }
>         done(identityExchange);
> 
>         return login;
>     }
> 
> ...
> 
> public void configureTarget(String serviceDesc, MessageExchange
> exchange, ComponentContext context,
>                                 QName _interface, QName service,
>                                 String endpoint, String uri) throws
> MessagingException {
>         if (_interface == null && service == null && uri == null) {
>             throw new MessagingException(serviceDesc + ": interface,
> service or uri should be specified");
>         }
>         if (uri != null) {
>             URIResolver.configureExchange(exchange, context, uri);
>         }
>         if (_interface != null) {
>             exchange.setInterfaceName(_interface);
>         }
> 
>         if (service != null) {
>             exchange.setService(service);
>             if (endpoint != null) {
>                 ServiceEndpoint se = context.getEndpoint(service,
> endpoint);
>                 exchange.setEndpoint(se);
>             }
>         }
>     }
> -------------------------------------------------------------------------------------------------------------------------
> 
> Bruce
> -- 
> perl -e 'print
> unpack("u30","D0G)[EMAIL PROTECTED]&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
> 
> Apache Geronimo - http://geronimo.apache.org/
> Apache ActiveMQ - http://activemq.org/
> Apache ServiceMix - http://servicemix.org/
> Castor - http://castor.org/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/SE-that-continually-reads-and-sends-data-tf3764809s12049.html#a10651622
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to