473,785 Members | 2,829 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

best practices on the creation of webmethods

Hi,

I was wondering if there are any best practices on the creation of
webmethods? I'll try to explain this a little more:
My problem is that we are changing an existing (large) DCOM application to
use web services, but we have like hundreds of different methods you can
call and what I wanted to do, is add a couple of generic webmethods that
take a serializable .NET class or structure, and in that class or structure
we put all the necessary information about the action that must be
performed. I would think this is a lot easier instead of adding all the
different methods, but my question is, if that is recommended to implement
this in such a way? If not, is it then recommended to add one service with
all these method, or is it better to split it up in different services? Is
there a recommended maximum of webmethods for one service?

I have to add that the web service will only be used internally, I mean that
normally no other company will use our web service (we create the client
application).

Any thought or suggestions are welcome.

Thanks,
Bert
Nov 23 '05 #1
14 2620
Bert Vandenberghe wrote:
we have like hundreds of different methods you
can
call and what I wanted to do, is add a couple of generic webmethods
that
take a serializable .NET class or structure, and in that class or
structure
we put all the necessary information about the action that must be
performed.
How would you handle each logical operation if not as a separate method?
I mean, you could go with some kind of command pattern and build some custom
routing, but why not leverage the frameworks that already exist for routing
the messages to the right methods and keep it broken up that way (ASMX or
WSE)?
I would think this is a lot easier instead of adding all
the
different methods, but my question is, if that is recommended to
implement
this in such a way?
I don't think it's easier at all. If anything you're going to make it harder
for people to consume because your generic approach, while perhaps infinitely
extensible, has to lack type specific details that make it harder for a caller
to understand what information is necessary for any given operation. For
example from a pure XML perspective your method would really just need to
take xsd:any and then people would have to go figure out what message they
want to send you and what parameters make up that method as opposed there
being four parameters directly on the method that they just need to pass.
If not, is it then recommended to add one service
with
all these method, or is it better to split it up in different
services?
You should probably break up the services based on some logical grouping
of operations. For example, if you had user management and order management
aspects, you would have two different services (UserManagement Service OrderManagement Service)
each with N methods for dealing with specific types.
Is
there a recommended maximum of webmethods for one service?
There is none, but like I said you'll probably want to break things up logically.
Think of it like the Win32 API. There's tons of methods in the Win32 right?
But when you want to do draw something to the screen you know where to go:
GDI. Now, there's still a ton of methods in GDI, but you know they're all
related in some way to drawing.
I have to add that the web service will only be used internally, I
mean that normally no other company will use our web service (we
create the client application).


Internal or external I still think it's in your best interests to design
it the way I've discussed above. Designing web services APIs is really are
no different than any other type of API design when it boils down to it.
You still want to avoid creating a monolithic frankenstein.

HTH,
Dre

Nov 23 '05 #2
Hi Bert:

If your distributed application is going to be used internally, you will be
better off by using .NET Remoting. Incase you do want web services try and
make your API chunky rather than chatty (that is, few web methods that each
do quite a bit is better than having lots of web methods that do one very
granular piece of functionality). Also, if you are using web services (and
not .NET Remoting) for the reason that you may change your client
environment someday, you should make your service compliant to WS-I Basic
Profile 1.0.

Thanks,
Mujtaba.

"Bert Vandenberghe" <en*********@ho tmail.com> wrote in message
news:eo******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

I was wondering if there are any best practices on the creation of
webmethods? I'll try to explain this a little more:
My problem is that we are changing an existing (large) DCOM application to
use web services, but we have like hundreds of different methods you can
call and what I wanted to do, is add a couple of generic webmethods that
take a serializable .NET class or structure, and in that class or
structure
we put all the necessary information about the action that must be
performed. I would think this is a lot easier instead of adding all the
different methods, but my question is, if that is recommended to implement
this in such a way? If not, is it then recommended to add one service with
all these method, or is it better to split it up in different services? Is
there a recommended maximum of webmethods for one service?

I have to add that the web service will only be used internally, I mean
that
normally no other company will use our web service (we create the client
application).

Any thought or suggestions are welcome.

Thanks,
Bert

Nov 23 '05 #3
What I was planning to do, is creating a webmethod with one argument which
is actually a serializable class like this:

[XmlRoot("Generi cMessage")]
public abstract class GenericMessage
{
public enum Action {ADD_THIS, ADD_THAT, EDIT_ANOTHER_TH ING, DELETE_THIS,
ADD};
public Action type;
....
}

Then it is also possible to derive other classes from this one with more
specific information about certain action and use it with the same
webmethod, e.g:

public class AddSpecialMessa ge : GenericMessage
{
public string moreInfo;
....
}

But like you mention, this would not be so clear for an external user what
you can do with this method, but I still think it would be easier than
creating all the seperate methods, just if you want to change something to
one of the method, or add a method...

Maybe it is indeed better to create all the seperate webmethods, thanks for
the advice,

Bert

"Drew Marsh" <dr****@hotmail .no.spamming.co m> wrote in message
news:10******** **************@ msnews.microsof t.com...
Bert Vandenberghe wrote:
we have like hundreds of different methods you
can
call and what I wanted to do, is add a couple of generic webmethods
that
take a serializable .NET class or structure, and in that class or
structure
we put all the necessary information about the action that must be
performed.
How would you handle each logical operation if not as a separate method?
I mean, you could go with some kind of command pattern and build some

custom routing, but why not leverage the frameworks that already exist for routing the messages to the right methods and keep it broken up that way (ASMX or
WSE)?
I would think this is a lot easier instead of adding all
the
different methods, but my question is, if that is recommended to
implement
this in such a way?
I don't think it's easier at all. If anything you're going to make it

harder for people to consume because your generic approach, while perhaps infinitely extensible, has to lack type specific details that make it harder for a caller to understand what information is necessary for any given operation. For
example from a pure XML perspective your method would really just need to
take xsd:any and then people would have to go figure out what message they
want to send you and what parameters make up that method as opposed there
being four parameters directly on the method that they just need to pass.
If not, is it then recommended to add one service
with
all these method, or is it better to split it up in different
services?
You should probably break up the services based on some logical grouping
of operations. For example, if you had user management and order

management aspects, you would have two different services (UserManagement Service OrderManagement Service) each with N methods for dealing with specific types.
Is
there a recommended maximum of webmethods for one service?
There is none, but like I said you'll probably want to break things up

logically. Think of it like the Win32 API. There's tons of methods in the Win32 right? But when you want to do draw something to the screen you know where to go:
GDI. Now, there's still a ton of methods in GDI, but you know they're all
related in some way to drawing.
I have to add that the web service will only be used internally, I
mean that normally no other company will use our web service (we
create the client application).


Internal or external I still think it's in your best interests to design
it the way I've discussed above. Designing web services APIs is really are
no different than any other type of API design when it boils down to it.
You still want to avoid creating a monolithic frankenstein.

HTH,
Drew

Nov 23 '05 #4
Hi Mujtaba,

I hestitated for a long time between .NET Remoting and web services,
but I thought that it is be better to choose web services with the eye on
the
future (Indigo). But it would indeed probably be better for performance to
choose .NET Remoting.
Should I start hesitating again now after reading your message?

Thanks for your advice,
Bert
"Mujtaba Syed" <mu*****@marlab s.com> wrote in message
news:e%******** ********@TK2MSF TNGP14.phx.gbl. ..
Hi Bert:

If your distributed application is going to be used internally, you will be better off by using .NET Remoting. Incase you do want web services try and
make your API chunky rather than chatty (that is, few web methods that each do quite a bit is better than having lots of web methods that do one very
granular piece of functionality). Also, if you are using web services (and
not .NET Remoting) for the reason that you may change your client
environment someday, you should make your service compliant to WS-I Basic
Profile 1.0.

Thanks,
Mujtaba.

"Bert Vandenberghe" <en*********@ho tmail.com> wrote in message
news:eo******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

I was wondering if there are any best practices on the creation of
webmethods? I'll try to explain this a little more:
My problem is that we are changing an existing (large) DCOM application to use web services, but we have like hundreds of different methods you can
call and what I wanted to do, is add a couple of generic webmethods that
take a serializable .NET class or structure, and in that class or
structure
we put all the necessary information about the action that must be
performed. I would think this is a lot easier instead of adding all the
different methods, but my question is, if that is recommended to implement this in such a way? If not, is it then recommended to add one service with all these method, or is it better to split it up in different services? Is there a recommended maximum of webmethods for one service?

I have to add that the web service will only be used internally, I mean
that
normally no other company will use our web service (we create the client
application).

Any thought or suggestions are welcome.

Thanks,
Bert


Nov 23 '05 #5
Bert Vandenberghe wrote:
I hestitated for a long time between .NET Remoting and web services,
but I thought that it is be better to choose web services with the eye
on
the
future (Indigo). But it would indeed probably be better for
performance to
choose .NET Remoting.
Should I start hesitating again now after reading your message?


You can still get perfectly acceptable performance from Web Services, it's
all about the design. Also, for a quick performance gain in your case, you
can eliminate HTTP from the equation since this is for an in house application
and just use WSE2.0's soap.tcp protocol. The design of your web services
doesn't have to change at all and if you still wanted to expose them over
HTTP in the future you would just start hosting the same classes in ASP.NET
instead.

HTH,
Dre

Nov 23 '05 #6
Hi Bert:

As per the WinHEC drop of Longhorn, Indigo supports two types of services:
Indigo web services (which are next gen web services) and Indigo
RemoteObject services (which are similar in spirit to .NET Remoting).

Your problem is made to be solved by .NET Remoting since you are doing
distributed objects on a homogeneous network.

Thanks.
Mujtaba.

"Bert Vandenberghe" <en*********@ho tmail.com> wrote in message
news:OT******** ******@TK2MSFTN GP09.phx.gbl...
Hi Mujtaba,

I hestitated for a long time between .NET Remoting and web services,
but I thought that it is be better to choose web services with the eye on
the
future (Indigo). But it would indeed probably be better for performance to
choose .NET Remoting.
Should I start hesitating again now after reading your message?

Thanks for your advice,
Bert
"Mujtaba Syed" <mu*****@marlab s.com> wrote in message
news:e%******** ********@TK2MSF TNGP14.phx.gbl. ..
Hi Bert:

If your distributed application is going to be used internally, you will

be
better off by using .NET Remoting. Incase you do want web services try
and
make your API chunky rather than chatty (that is, few web methods that

each
do quite a bit is better than having lots of web methods that do one very
granular piece of functionality). Also, if you are using web services
(and
not .NET Remoting) for the reason that you may change your client
environment someday, you should make your service compliant to WS-I Basic
Profile 1.0.

Thanks,
Mujtaba.

"Bert Vandenberghe" <en*********@ho tmail.com> wrote in message
news:eo******** ******@TK2MSFTN GP09.phx.gbl...
> Hi,
>
> I was wondering if there are any best practices on the creation of
> webmethods? I'll try to explain this a little more:
> My problem is that we are changing an existing (large) DCOM application to > use web services, but we have like hundreds of different methods you
> can
> call and what I wanted to do, is add a couple of generic webmethods
> that
> take a serializable .NET class or structure, and in that class or
> structure
> we put all the necessary information about the action that must be
> performed. I would think this is a lot easier instead of adding all the
> different methods, but my question is, if that is recommended to implement > this in such a way? If not, is it then recommended to add one service with > all these method, or is it better to split it up in different services? Is > there a recommended maximum of webmethods for one service?
>
> I have to add that the web service will only be used internally, I mean
> that
> normally no other company will use our web service (we create the
> client
> application).
>
> Any thought or suggestions are welcome.
>
> Thanks,
> Bert
>
>



Nov 23 '05 #7
Is using soap over tcp faster than over http? Otherwise it is indeed better
that we install WSE2.0 and that we use tcp instead of http. Thanks for the
tip.

And I think it is indeed more fexible to use web services, just in case a
customer wants to expose it on the internet, you never know...

Thanks,
Bert

"Drew Marsh" <dr****@hotmail .no.spamming.co m> wrote in message
news:10******** **************@ msnews.microsof t.com...
Bert Vandenberghe wrote:
I hestitated for a long time between .NET Remoting and web services,
but I thought that it is be better to choose web services with the eye
on
the
future (Indigo). But it would indeed probably be better for
performance to
choose .NET Remoting.
Should I start hesitating again now after reading your message?
You can still get perfectly acceptable performance from Web Services, it's
all about the design. Also, for a quick performance gain in your case, you
can eliminate HTTP from the equation since this is for an in house

application and just use WSE2.0's soap.tcp protocol. The design of your web services
doesn't have to change at all and if you still wanted to expose them over
HTTP in the future you would just start hosting the same classes in ASP.NET instead.

HTH,
Drew

Nov 23 '05 #8
Hi Mujtaba,

I was not aware of the 2 different types of services in Indigo, I'll take a
look at that, thanks.
But my choice for web services was based on a video I saw of Richard Turner
(Program manager of Indigo):
http://channel9.msdn.com/ShowPost.aspx?PostID=9990

If you take a look at it, you'll see that he is saying that you may only use
remoting when absolutely necessary, otherwise he advises to use webservices.

Thanks,
Bert

"Mujtaba Syed" <mu*****@marlab s.com> wrote in message
news:e4******** ******@TK2MSFTN GP09.phx.gbl...
Hi Bert:

As per the WinHEC drop of Longhorn, Indigo supports two types of services:
Indigo web services (which are next gen web services) and Indigo
RemoteObject services (which are similar in spirit to .NET Remoting).

Your problem is made to be solved by .NET Remoting since you are doing
distributed objects on a homogeneous network.

Thanks.
Mujtaba.

"Bert Vandenberghe" <en*********@ho tmail.com> wrote in message
news:OT******** ******@TK2MSFTN GP09.phx.gbl...
Hi Mujtaba,

I hestitated for a long time between .NET Remoting and web services,
but I thought that it is be better to choose web services with the eye on the
future (Indigo). But it would indeed probably be better for performance to choose .NET Remoting.
Should I start hesitating again now after reading your message?

Thanks for your advice,
Bert
"Mujtaba Syed" <mu*****@marlab s.com> wrote in message
news:e%******** ********@TK2MSF TNGP14.phx.gbl. ..
Hi Bert:

If your distributed application is going to be used internally, you will
be
better off by using .NET Remoting. Incase you do want web services try
and
make your API chunky rather than chatty (that is, few web methods that

each
do quite a bit is better than having lots of web methods that do one
very granular piece of functionality). Also, if you are using web services
(and
not .NET Remoting) for the reason that you may change your client
environment someday, you should make your service compliant to WS-I Basic Profile 1.0.

Thanks,
Mujtaba.

"Bert Vandenberghe" <en*********@ho tmail.com> wrote in message
news:eo******** ******@TK2MSFTN GP09.phx.gbl...
> Hi,
>
> I was wondering if there are any best practices on the creation of
> webmethods? I'll try to explain this a little more:
> My problem is that we are changing an existing (large) DCOM application to
> use web services, but we have like hundreds of different methods you
> can
> call and what I wanted to do, is add a couple of generic webmethods
> that
> take a serializable .NET class or structure, and in that class or
> structure
> we put all the necessary information about the action that must be
> performed. I would think this is a lot easier instead of adding all
the > different methods, but my question is, if that is recommended to

implement
> this in such a way? If not, is it then recommended to add one service

with
> all these method, or is it better to split it up in different services? Is
> there a recommended maximum of webmethods for one service?
>
> I have to add that the web service will only be used internally, I

mean > that
> normally no other company will use our web service (we create the
> client
> application).
>
> Any thought or suggestions are welcome.
>
> Thanks,
> Bert
>
>



Nov 23 '05 #9
Bert,

One thing I try to design in my webservices is to reduce the need for round
trips to the webservice. So I attempt to rework some of my back-end methods
to reduce this. For example, typically, if I wanted to load information
about a customer, I might have something like:

1) Find Customer ID based on Emailaddress
2) Load customer object

In your webservice, you may think of implementing both of these methods, but
then for the consummer to load a customer in this fashion takes 2 round
trips to the webservice. It would work, but to reduce the round trips, I
would construct one webmethod that would load a customer based on email
address:

public CustomerClass GetCustomerFrom Email(string emailadress);
public CustomerClass GetCustomerFrom ID(string custid);

I realize this is a simplistic version, but hope you get the idea.
I guess maybe that's just good API design to begin with though.

Steve


"Bert Vandenberghe" <en*********@ho tmail.com> wrote in message
news:eo******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

I was wondering if there are any best practices on the creation of
webmethods? I'll try to explain this a little more:
My problem is that we are changing an existing (large) DCOM application to
use web services, but we have like hundreds of different methods you can
call and what I wanted to do, is add a couple of generic webmethods that
take a serializable .NET class or structure, and in that class or structure we put all the necessary information about the action that must be
performed. I would think this is a lot easier instead of adding all the
different methods, but my question is, if that is recommended to implement
this in such a way? If not, is it then recommended to add one service with
all these method, or is it better to split it up in different services? Is
there a recommended maximum of webmethods for one service?

I have to add that the web service will only be used internally, I mean that normally no other company will use our web service (we create the client
application).

Any thought or suggestions are welcome.

Thanks,
Bert

Nov 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
5571
by: mdh | last post by:
I have an application written for mod_perl and Apache that needs to be able to send some XML queries to a WebMethods server for access to corporate systems. I have been attempting to use LWP to POST my XML query to the target WebMethods server and find I only get 401s (authorization errors) from the WebMethods server when it is configured for username/password authentication. If credentials are turned off on the WM server, I can get my...
2
1973
by: byrocat | last post by:
I'm chasing after a documetn that was available on one of the Microsoft websites that was titled somethign like "MS SQL Server Best Practices" and detailed a nyumber of best practices about securing the server. Included in this was revoking public access to the system table objects. Can someone post the URL where I can pick this up, or drop me a note on contacting them for a copy of the document?
136
9457
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their code was littered with document.all and eval, for example, and I wanted to create a practical list of best practices that they could easily put to use. The above URL is version 1.0 (draft) that resulted. IMO, it is not a replacement for the FAQ,...
13
2284
by: john doe | last post by:
A quick question, about so-called 'best practices', I'm interested in which of A/B of the two examples people would choose, and why. public enum MyEnum { Option1 = 0, Option2 = 1, Option3 = 2, Option4 = 3
10
3483
by: jojobar | last post by:
Hello, I am trying to use vs.net 2005 to migrate a project originally in vs.net 2003. I started with creation of a "web site", and then created folders for each component of the site. I read somewhere that each folder under the "web site" is compiled in separate assembly. I however, did not find that the "web site" creation in vs.net 2005 created any AssemblyInfo.cs file.
3
2246
by: John Dalberg | last post by:
I am looking for an ASP.NET application on CodePlex which exemplifies best practices for the following: - Use of interfaces - Seperation of the UI, business and data tiers - Data Tier that uses Enterprise Libraries data layer (if possible) - Use of providers (if possible) - use of factories (if possible) - use of caching - Session management
6
1182
dennison
by: dennison | last post by:
I am trying to write code for a class that has a couple of attributes that will can only be known upon creation. Because I think accessor functions (e.g. getSomething()) are outdate, I declared my attributes as "public readonly" in order to protect the attributes from getting modified yet still accessible by the parent class. I am not convinced that this is the best practice for this. Implementing properties seem like a bit of a waste of time to...
2
2170
by: sabbadin12 | last post by:
Hi, I'm going to work on an application that uses a postgreSQL database so that it can uses SQLServer 2005. I think I solved most problems on the programming side, but I still have some doubts on the DB side regarding how to handle the creation of the db schema on sqlserver and how to handle the every day dba work. 1) should I try to use an ER tool like Embarcadero and have its logical model be the master copy ? (i did some tests, it...
4
1530
by: trullock | last post by:
Hi, Can anyone suggest the best way to go about the following... I'm tracking clicks (mouse down x,y coordinates) on a web page by using some javascript to create an XHR which sends the coordinates to a recording service, such as: /Record.ashx?X=123&Y=456
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10327
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3647
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.