Suggestion for approach in finding the bookquote with least price

View: New views
6 Messages — Rating Filter:   Alert me  

Suggestion for approach in finding the bookquote with least price

by Karthikeyan Chockalingam :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All,

Let us assume there are 2 bookstores (bookstoreA and bookstoreB) which
expose CXF based web service to get the price of a book given the ISBN.
(These are external applications.)

The web application (let us call it *CustomerWebApp*) which needs to
display the least price to the customer contacts the  Mule based web
application (Mule embedded ). [ *CustomerWebApp *invokes Mule based web
application through a CXF inbound endpoint (using JAXWS)]

Inturn the Mule based web application should contact bookstoreA and
bookstoreB and return a single Book object (which has the least price)
synchronously to CustomerWebApp.

I have read the posts, webinar and wiki regarding proxy but I am not
sure it will fit here as I need to return only one Book object in the
SOAP response (after comparing the Books from bookstoreA and bookstore B).

Can you please suggest the optimal approach in implementing the above
scenario?

Thanks,
Karthikeyan C

Re: Suggestion for approach in finding the bookquote with least price

by Andrew Perepelytsya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This is a classic case. 2 things to get you started:
  1. Response Aggregator
  2. Check out Mule's LoanBroker example http://www.mulesource.org/display/MULE2INTRO/Loan+Broker+Example Go through various versions, study the diagrams, etc.
HTH,
Andrew

Re: Suggestion for approach in finding the bookquote with least price

by David Dossot-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You may want to study this example: http://www.mulesource.org/display/MULE2INTRO/Loan+Broker+Example

D.

On Fri, Jul 3, 2009 at 10:34 AM, Karthikeyan Chockalingam <bercolax@...> wrote:

Hi All,

Let us assume there are 2 bookstores (bookstoreA and bookstoreB) which
expose CXF based web service to get the price of a book given the ISBN.
(These are external applications.)

The web application (let us call it *CustomerWebApp*) which needs to
display the least price to the customer contacts the  Mule based web
application (Mule embedded ). [ *CustomerWebApp *invokes Mule based web
application through a CXF inbound endpoint (using JAXWS)]

Inturn the Mule based web application should contact bookstoreA and
bookstoreB and return a single Book object (which has the least price)
synchronously to CustomerWebApp.

I have read the posts, webinar and wiki regarding proxy but I am not
sure it will fit here as I need to return only one Book object in the
SOAP response (after comparing the Books from bookstoreA and bookstore B).

Can you please suggest the optimal approach in implementing the above
scenario?

Thanks,
Karthikeyan C

--
View this message in context: http://www.nabble.com/Suggestion-for-approach-in-finding-the-bookquote-with-least-price-tp24326522p24326522.html
Sent from the Mule - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




Re: Suggestion for approach in finding the bookquote with least price

by Karthikeyan Chockalingam :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the input. I have gone through the LoanBroker example and have also implemented the lowest book price quote in a similar fashion (which works and yields the desired result).

The Book quote differs in that it has two consecutive layers of webservice invocation (Loan Broker does not have 2 layers of consecutive CXF invocation)

- The point which i am not sure if it is the right way of doing things in my implementation (code provided below) is the invocation of BookPriceServiceImpl component (The input to the webservice is the ISBN String.) as I have to return a Book as per the contract as in the below Java code.

As we see I have to return a Book object instead of just the ISBN String for follow up CXF invocations of BookStoreA and BookStoreB which take only the ISBN String. So again a transformation of Book--> String is required which may be redundant.

I may be implementing it in the wrong manner as I am a Mule begineer. Kindly suggest if there are better ways.

package com.ta.bscentral.wsimpl;

import com.ta.bscentral.ws.BookPriceService;
import com.ts.dto.Book;
import javax.jws.WebService;

@WebService(serviceName="BookPriceService", endpointInterface="com.ta.bscentral.ws.BookPriceService")
public class BookPriceServiceImpl implements BookPriceService {
    @Override
    public Book getLowestPrice(String isbn) {
        Book book=new Book();
        book.setIsbn(isbn);
        return book;
    }
}

My Mule config file looks as below.

    <service name="LowestPriceService">
            <inbound>
                <inbound-endpoint address="cxf:http://0.0.0.0:8777/bplow/services/BookPriceService" synchronous="true"/>
             </inbound>
            <component>
                <singleton-object class="com.ta.bscentral.wsimpl.BookPriceServiceImpl" />
            </component>
            <outbound>
                <multicasting-router>
                    <jms:outbound-endpoint queue="bookstoreA" synchronous="false"/>
                    <jms:outbound-endpoint queue="bookstoreB" synchronous="false"/>
                    <reply-to address="resultq" />
                </multicasting-router>
             </outbound>
            <async-reply timeout="20000">
                <inbound-endpoint ref="resultq" />
                <custom-async-reply-router class="com.ta.mule.LowestPriceResponseAggregator" />
            </async-reply>
   </service>

Parent Message unknown Re: Suggestion for approach in finding the bookquote with least price

by Andrew Perepelytsya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Put another service in between cxf and jms that will populate the Book based on ISBN. So it becomes:

cxf -> New Service -> LowestPriceService (Fan Out + Collect Results) -> New Service gets response -> Query Book by ISBN.

HTH,
Andrew

P.S.: please don't send me private messages.

Re: Suggestion for approach in finding the bookquote with least price

by Karthikeyan Chockalingam :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the suggestion.

Is it possible to skip the invoke of implementation class of CXF inbound end-point (the component mentioned) without setting proxy="true" ?