Basic question about creating/setting up webservices

  • Thread starter news.microsoft.com
  • Start date
N

news.microsoft.com

I have been looking around at the documentation and have come across a lot
about how to create webservices and consume them.

I have a fairly large 3 tier application with a ton of classes in c# that
are currently being used by the website. Is there a quick/ rad tool that can
take a c# class and generate a webservice proxy/asmx file? Any suggestions
that does not involve writing the guts of the code from scratch :) would be
really helpful.

Thanks in advance

Sanjay
 
D

Dan Rogers

Hi Sanjay,

Is the reason you want to refactor your application related to wanting to
share out all of the logic your web site uses to outside parties? If not,
then perhaps you want to think about what specific facades on your internal
logic you want to expose.

When you say you have existing classes, is it safe for me to assume that
your current web service code creates instances of these classes and then
uses them for types (data) and for the methods that operate on them? In
general, there is a quite a bit of work to do to make these refactored to a
web service due to issues with state-vs-statelessness, chatty versus chunky
designs, coupling etc, so without far more knowledge of the way your
current applications work, it is hard to say you could be successful at
just turning all of your methods and classes into web services.

Moving over to a service orientation requires some thoughts about making
the caller as independent as possible - and using the service side as a
gateway to application functionality, rather than a normal tightly coupled
object based system that lets setters and getters and methods all be mixed
together. In general, if your objects have business logic on your property
setters, or allow the caller to make assumptions about statefulness in the
managed code objects, there is a poor web service match and a lot of
refactoring for "very long distance (e.g. disconnected), stateless
behaviors" . Think of a web service based caller as being able to safely
assume that you connect and then dispose of your object references on each
use of a service (method).

I hope this helps

Dan Rogers
Microsoft Corporation
--------------------
 
S

Softwaremaker

Are you referring to a proxy stub class or an asmx documentation file ?
These are 2 different things altogether ;-)

If I were you, my asmx does NOT even contain guts or any business logic.
They will just act as gateways to your C# classes containing business
application logic.

--
Thank you.

Regards,
Softwaremaker
http://www.softwaremaker.net/blog

=========================================
 
S

Sanjay Pais

Hmmm I am indeed ignorant about the guts of webservices :) Let me explain
what I really need:
We have a three tier web application that uses the UIP, Data and Error
blocks. As
all the business logic is contained in the C# classes in the business layer,
I was hoping to expose
some /all of that logic via webservices so that I could make use of it via
other thin/thick clients.

Having said that, at this point this is really an experiment/ proof of
concept that I am doing. The
business layer has built in security so that in order to use the methods in
the classes, the client
would need to be authenticated and possess a valid token.

I was hoping to create objects in the webservices layer that act as
proxies/stubs for the classes.

I hope this answers you question?

Thanks for the reply.

Sanjay
 
S

Sanjay Pais

Hi Dan,

Thanks for replying to my post.

The business facade has security wrapped into it. In order to make use of
the
methods on the business layer, a user would need to be authentated which
results in a token being generated that is required by the business facade
as
part of the parameters of al the methods.

If I able to autogenerate web service proxies for my c# classes than I am at
a
liberty to decide which of the public methods I want to allow/disallow by
merely
commenting the code.

Our existing ASP.NET application uses the ms datablocks, uip, and error
blocks,
there is the presentation layer provided in stateless pages that are able to
maintain state
as and when required by the UIP layer.

Thanks in advance....

Sanjay
To step back
 
D

Dan Rogers

Hi Sanjay,

One thing you mentioned was being able to secure your service by commenting
out methods in the proxy. I'd submit that this isn't very secure since
anyone can regenerate the full proxy at any time. A better way to secure
who can call what method is to add security to your service layer. There
are many choices, including using windows integrated security, and others.
If you haven't investigated the Web Service Extension tools (WSE 2.0, SP1),
then I recommend you download these now from MSDN.

Regards

Dan Rogers
Microsoft Corporation
--------------------
 
S

Softwaremaker

Sanjay Pais said:
Hmmm I am indeed ignorant about the guts of webservices :) Let me explain
what I really need:
We have a three tier web application that uses the UIP, Data and Error
blocks. As
all the business logic is contained in the C# classes in the business layer,
I was hoping to expose
some /all of that logic via webservices so that I could make use of it via
other thin/thick clients.

Having said that, at this point this is really an experiment/ proof of
concept that I am doing. The
business layer has built in security so that in order to use the methods in
the classes, the client
would need to be authenticated and possess a valid token.

[Softwaremaker] Can be done in WSE. Hang around
microsoft.public.dotnet.framework.webservices.enhancements
I was hoping to create objects in the webservices layer that act as
proxies/stubs for the classes.

[Softwaremaker] proxies/stubs are meant for your service consumers. Your
asmx class file acts as gateways to your business layer. My own person
opinion is that you shouldnt be building [WebMethod] into your business
layer.

[WebMethod] Public Function DoSomeBusinessProcess (pSKU as StockKeepUnit)

Dim abc as BusinessLayer.BusinessFacade

return abc.DoSomeBusinessProcess(pSKU)

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top