views:

84

answers:

2

Can any one explain the use of service agent while calling web service? how it fit in project architecture?

A: 

In MVC a.k.a. Model View Controller,

View -> Controller -> Service Agent

Service Agent acts like proxy to the web service. It can sit at resource access layer in your application.

  • Controller initializes a call to the service agent because the view requires some data or needs to perform some operations from the services.
  • After controller gets the result from the agent, it performs some logic and applies the Model to the view.

EDIT:

The agent wraps proxy classes so that it will take care of the instancing of the proxies and handling the errors from the server etc. Proxy classes are the generic interfaces to the web service and agents have more logic implemented for the services related. E.g. you can translate the response into Model and return it to the Controller.

codemeit
So how does a Service Agent differ from the web service proxy classes we've been using for years, and why do they deserve their own name ("service agent")?
John Saunders
Check out the edited post.
codemeit
A: 

can any one post a sample for service Agent pattrens.

Sappidireddy