Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / December 2005

Tip: Looking for answers? Try searching our database.

Optional parameter in a web service?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
UJ - 27 Dec 2005 17:02 GMT
Is there a way to make a parameter optional in a web server? I've got two
routines that will work almost exactly the same except that one needs an
extra parameter to do a check. I supposed I could something like:

public int WithOneParm ( int parm1 )
{
}

public int WithTwoParm (int parm1, int parm2 )
{
   // Do what is needed for this.
   WithOneParm ( parm1 );
}

but I'd love to be able to have just the one routine.

TIA - Jeff.
Martin Kulov - 28 Dec 2005 18:10 GMT
> Is there a way to make a parameter optional in a web server?

Hi Jeff,

AFAIK, you can not create optional parameters in web services.
That's a design restriction, at least for now.
However you van overload the method and create versions of the method with
one and two parameters.

Happy holidays,

Signature

Martin Kulov
http://www.codeattest.com/blogs/martin

MCAD Charter Member
MCSD.NET Early Achiever
MCSD


BobG - 30 Dec 2005 20:21 GMT
You could do this with a dataset that has 2 tables. Each table has one column
and one row. Place the required parameter in one table and the optional
parameter in the other.

Note with this approach the datatypes of the parameters can be different and
it's not a problem.

Good luck with your work!

> Is there a way to make a parameter optional in a web server? I've got two
> routines that will work almost exactly the same except that one needs an
[quoted text clipped - 13 lines]
>
> TIA - Jeff.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.