Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > General Question About Web Service Architecture

Reply
Thread Tools

General Question About Web Service Architecture

 
 
pbd22
Guest
Posts: n/a
 
      07-24-2009
Hi.

I am generally wondering about the best type of architecture when
designing a web service. It would be helpful to me if somebody could
look at the below "flow" and comment accordingly (does this look
right?). Also, I have two related questions:

1) Will web service calls always be initiated from within the context
of a JavaScript function (as described in #3)?

2) Will the actual web service (the code that grabs data and returns
it as an xml or json - formatted string) always be a separate and
distinct web project from my main Web application?

THIS HAPPENS IN MY MAIN WEB PROJECT:

1) ASPX page button click event

2) fire click_button() on same page

3) from the click_button() function
a call to the location of the web service
server is made passing the click events
associated values. For example:

..getJSON("http://api.domain.com/services/dosomething?q=words")

THIS HAPPENS IN MY WEB SERVICE PROJECT:

4) In the code behind of the dosomething.aspx page, a
SOAP call (SomethingService someserv = new SomethingService() is
made to a service that that retrieves
data and formats it (say, JSON) for response to the client.

Thanks in advance. I appreciate your time and expertise.
 
Reply With Quote
 
 
 
 
Mr. Arnold
Guest
Posts: n/a
 
      07-26-2009

"pbd22" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi.
>
> I am generally wondering about the best type of architecture when
> designing a web service. It would be helpful to me if somebody could
> look at the below "flow" and comment accordingly (does this look
> right?). Also, I have two related questions:
>
> 1) Will web service calls always be initiated from within the context
> of a JavaScript function (as described in #3)?


I don't know what you're talking about. You don't need JavaScript to make a
Web service call. You can call the Web service from a Windows desktop
solution, as an example. A Web service can be called from MVP, MVC, BLL or
DAL layers, that have nothing to do with JavaScript.
>
> 2) Will the actual web service (the code that grabs data and returns
> it as an xml or json - formatted string) always be a separate and
> distinct web project from my main Web application?


It should be a separate project that can be part of a total solution in the
..snl. But nevertheless, it should be a separate project. The Web service is
a Web site offering a service that should be/can be consumed by any type of
client, not just an ASP.NET solution.

> THIS HAPPENS IN MY MAIN WEB PROJECT:
>
> 1) ASPX page button click event
>
> 2) fire click_button() on same page
>
> 3) from the click_button() function
> a call to the location of the web service
> server is made passing the click events
> associated values. For example:
>
> .getJSON("http://api.domain.com/services/dosomething?q=words")
>
> THIS HAPPENS IN MY WEB SERVICE PROJECT:
>
> 4) In the code behind of the dosomething.aspx page, a
> SOAP call (SomethingService someserv = new SomethingService() is
> made to a service that that retrieves
> data and formats it (say, JSON) for response to the client.


It should just be XML as you should make the solution more viable to other
types of clients that may want to consume the Web service.


__________ Information from ESET NOD32 Antivirus, version of virus signature database 4279 (20090726) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



 
Reply With Quote
 
 
 
 
pbd22
Guest
Posts: n/a
 
      07-29-2009
Thanks Mr. Arnold.

I appreciate the response.

I think I need to back up a bit and explain where I am getting
stuck...

I have a WCF Class Library that contains a number of
interfaces:

ITradeService
IAuthService
IHelperService
And so on...

I was reading through a blog that described how to use
AJAX/JSON/WCF to populate client-side data. The
javascript call looked something like (I think this is jquery):

Code:

$(document).ready(function(){
$.getJSON("http://api.domain.com/services/buy.svc?
q=" + query.value + "&type=" + type.value + "&format=json",
function(data){
$.each(data.items, function(i,item){
$("<img/>").attr("src",
item.media.m).appendTo("#images");
if ( i == 3 ) return false;
});
});
});



Up until this point, I have been able to reference my WCF class
library (as a Service Reference) in my Web Project and call the
necessary methods.

But, the above code got me asking the question - "What is a SVC file
and why do I need it"? Apparently if I want to expose my interfaces to
the rest of the world, I need an SVC file?

MY QUESTION IS - What is the best way to go about exposing the
endpoints described in my current WCF client library?

Based on some online gardening, I have found the following:

1) Create a WCF application under the solution and reference the WCF
class library in this project. Then, create a client proxy that
exposes the library's end points. Finally, reference the the newly
created WCF service as a Web Service in the Web Application.

2) Reference the WCF Client Library in my Web Application, exposing
the endpoints by using something called a "ClientFactory"? Does that
sound correct?

I would prefer to avoid a proxy if I can and option number two sounds
like a good bet. I don't really understand, however, how this works.

Could you (or somebody) explain how to expose the endpoints in my WCF
class library without creating a proxy? Also, what would the AJAX
JavaScript call look like?

I hope I have done a better job at explaining myself. Thanks again for
your time and help.
 
Reply With Quote
 
Mr. Arnold
Guest
Posts: n/a
 
      07-29-2009

"pbd22" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks Mr. Arnold.
>
> I appreciate the response.
>
> I think I need to back up a bit and explain where I am getting
> stuck...
>
> I have a WCF Class Library that contains a number of
> interfaces:
>
> ITradeService
> IAuthService
> IHelperService
> And so on...
>
> I was reading through a blog that described how to use
> AJAX/JSON/WCF to populate client-side data. The
> javascript call looked something like (I think this is jquery):
>
> Code:
>
> $(document).ready(function(){
> $.getJSON("http://api.domain.com/services/buy.svc?
> q=" + query.value + "&type=" + type.value + "&format=json",
> function(data){
> $.each(data.items, function(i,item){
> $("<img/>").attr("src",
> item.media.m).appendTo("#images");
> if ( i == 3 ) return false;
> });
> });
> });
>
>
>
> Up until this point, I have been able to reference my WCF class
> library (as a Service Reference) in my Web Project and call the
> necessary methods.
>
> But, the above code got me asking the question - "What is a SVC file
> and why do I need it"? Apparently if I want to expose my interfaces to
> the rest of the world, I need an SVC file?


The svc file exposes the Web service to a Internet or Intranet client.

>
> MY QUESTION IS - What is the best way to go about exposing the
> endpoints described in my current WCF client library?
>
> Based on some online gardening, I have found the following:
>
> 1) Create a WCF application under the solution and reference the WCF
> class library in this project. Then, create a client proxy that
> exposes the library's end points. Finally, reference the the newly
> created WCF service as a Web Service in the Web Application.
>
> 2) Reference the WCF Client Library in my Web Application, exposing
> the endpoints by using something called a "ClientFactory"? Does that
> sound correct?
>
> I would prefer to avoid a proxy if I can and option number two sounds
> like a good bet. I don't really understand, however, how this works.
>
> Could you (or somebody) explain how to expose the endpoints in my WCF
> class library without creating a proxy? Also, what would the AJAX
> JavaScript call look like?



How hard can it be to look this up using Bing or Google.

<http://www.programminghelp.com/web-development/ajax/consuming-a-wcf-service-with-client-side-ajax-in-c/>


> I hope I have done a better job at explaining myself. Thanks again for
> your time and help.


What you need to do is create a WCF Web service reference in a project, by
using the .svc file and pasting it in the Service Reference wizard of a
project. The outputted App.config file will contain the WCF Web service
entries that you would copy to the Web.config of the ASP.NET client project,
under <system.serviceModel>. If the WCF Web service is created with the
Service Reference wizard in an ASP.NET client project, then it's going to
put the WCF config info into in the Web.Config itself.

I suggest you get yourself a good WCF book and start at page 1 and the
basics, before you get to the complicated stuff. The book will go over the
complicated stuff too. Most of these books you don't even have to buy
anymore because of free e-books and Google books online.






__________ Information from ESET NOD32 Antivirus, version of virus signature database 4289 (20090729) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
web service boundaries for service oriented architecture Purushottam Khandebharad ASP .Net Web Services 1 12-20-2005 11:47 AM
Architecture question: should I use a web service as back end to my web front end? Karen Sundquist ASP .Net Web Services 1 12-01-2003 06:28 AM
Re: General EXE/DLL architecture question Rayiner Hashem C++ 0 08-11-2003 10:07 PM
Re: General EXE/DLL architecture question Bren C++ 1 08-11-2003 09:06 PM
how can I use a signal defined in one Architecture to another Architecture Muhammad Khan VHDL 4 07-10-2003 06:14 PM



Advertisments