Configuration for using a Web Service to an Application Server

Configuration for using a Web Service to an Application Server

Old forum URL: forums.lhotka.net/forums/t/1357.aspx


ktweedy posted on Friday, September 29, 2006

I am looking into how to implement a 4 phystical teir architecture with CSLA.

In my applcation we will have web form call a web service which will need to call an application server which will talk to the database server.

After the objects go through the web service and are deserialized they will have their DataPortal function called.  Typically I would just talk to the database at that time and be done but in this situation I need to make an addition jump with the business object to the application server and perform my database access their and then return to the web server, which will then return to the client.

To make it more interesting I would also like to have control over when we jump to the application server and when we can stay and perform the command on the the web server.  For instance a fetch command could be performed on the web server, but a create, insert or update command we would like to have done on the application server to reduce the load on the web server.

I see a couple options but would appreciate some thoughts or ideas.

1. Develop and Application Server DataPortal
Implement a version of the DataPortal on the web server that doesn't make the DataPortal_function call there but instead turns around an makes a remoting call to the application server and passes the business object there to have its DataPortal function call.  I could implement an attribute that I could use to decide to make the jump to the application server or to run on the Web Server.  This seems to me to be the most power solution and would have the least impact on my application design.

2. A Deferred Save call
My next thought is on the client I never call the Save function directly on my objects but instead implement a command like object and pass in the criteria class my business object.  So on the server I could get my business object from the criteria and called its Save() function there.  I beleive I can then have the dataportal configuration pointing to my application server so it will serialize my object and send it off to the application server to call its DataPortal_function.  The my business object will return to the client as a child object of the command object where I could get it to get the new copy of the business object.

3. Create command objects on the Web Server
Let the client call the business object's save function then on the web server when the code gets to the DataPortal_function create an command like object and sets its criteria to the business object that has been deserialized there and then call the command object's Save() function so that the DataPort on the web server will serialize the business object again and send it off the the application server to have the DataPort_functional called which will in turn retrieve the business object from the criteria and call the Save() function on it again there.  Not sure this will work though since when it is done it will return an object to the Web Server which somehow needs to be returned or copied onto intelf to be returned to the client.

Any thoughts would be appreciated.  I did a search and didn't see any other topics on this so sorry if this has been discussed before.

 

RockfordLhotka replied on Friday, September 29, 2006

I'm not sure I follow.

You are passing the object from a WEB Forms UI to the web server? And then from the web server to an app server?

I could see this working with a Windows Forms UI, using the web service data portal channel to a web server, which then needs to shift the call to an app server - but without some really nasty hacking (which is possible - I've done it) it is really hard to get business objects actually running in the browser.

pliekhus replied on Friday, September 29, 2006

I find this post interesting as I am trying to do something similar (if I understand it correctly) on the same day and cannot figure it out.  Here is my scenario (from the database out). 

1.  Application Server behind DMZ that has access to the database.  Other layers get here through the RemotingPortal.

2.  Web site talking to the Application Server.  Everything here works fine and I am happy.

3.  Web Service exposed to accept other connections.  This is exposed through another firewall.  If I connect this layer directly to the database it works fine.  However, I set the CslaDataPortalProxy and CslaDataPortalUrl to talk to the RemotingPortal configured above.

4.  Other website that talks to my business objects through the web service layer.

5.  Smart Client front end that talks to my business objects through the web service layer.

Basically the issue that I am having is that none of my business objects will fill successfully once I bounce through the Web Service to the Remoting Service layer.  Is there something that I am missing?

The issue that I have is outlined below

                                 |F|      Public Website -------\     |D|
Other Website --\      |I|                                          >--|M| Remoting Portal -------> Database
                            >--|R|----Web Service ---------/     |Z|
Smart Client ----/      |E|
                                |W|
                                |A|
                                |L|
                                |L|

Thanks for your assistance.

RockfordLhotka replied on Saturday, September 30, 2006

The data portal is a "one hop" technology. You can't "chain" data portal calls like you are attempting to do.

ktweedy replied on Tuesday, October 03, 2006

Hi, thanks for the feedback.  Was out of work for a few days so just now getting back to this.

RockfordLhotka:
The data portal is a "one hop" technology. You can't "chain" data portal calls like you are attempting to do.

I am curious why you say this can't be done.  Is there a technical issue or a design issue related to CSLA that prevents this.  I understand CSLA out of the box may not be able to do this.

Conceptually it seems with the channel adapter/message router patter that the output of the message router can be another channel adapter which would send the message off into another channel.  This second channel would be the application server.

Any thoughts?

 

 

RockfordLhotka replied on Tuesday, October 03, 2006

Oh sure, you could write a router component to run on your web server. It just isn't something you get "out of the box" so to speak.
 
This router component would basically implement the WebServiceHost interface like the one in Csla.dll, except that it wouldn't delegate to Server.DataPortal. Instead, it would delegate to a proxy that would, in turn, call the real data portal server on the app server.
 
I wouldn't think it would be terribly hard to write such a router component - other than the Web Service interface, everything in the data portal's message router implementation is interface-based and so could be transparently augmented without altering CSLA itself.
 
You'd need to create a new client-side proxy, a host for your router, and a proxy for your router that relays the call to the real host from Csla.dll.
 
While your router could, perhaps, use the existing data portal to invoke the server, I don't think you want to do that, because that would force you to deserialize the message on the web server, just to reserialize it again. Since the web server would be nothing more than a pass-through, you are (I think) better off not deserializing the message if you can avoid it.
 
Rocky


From: ktweedy [mailto:cslanet@lhotka.net]
Sent: Tuesday, October 03, 2006 10:51 AM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] Configuration for using a Web Service to an Application Server

Hi, thanks for the feedback.  Was out of work for a few days so just now getting back to this.

RockfordLhotka:
The data portal is a "one hop" technology. You can't "chain" data portal calls like you are attempting to do.

I am curious why you say this can't be done.  Is there a technical issue or a design issue related to CSLA that prevents this.  I understand CSLA out of the box may not be able to do this.

Conceptually it seems with the channel adapter/message router patter that the output of the message router can be another channel adapter which would send the message off into another channel.  This second channel would be the application server.

Any thoughts?

 

 




ktweedy replied on Wednesday, October 04, 2006

Thanks, that is what I was hoping to hear.

Thanks again.

Copyright (c) Marimer LLC