Optional parameter in a web service?

U

UJ

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.
 
M

Martin Kulov

UJ said:
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,

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

MCAD Charter Member
MCSD.NET Early Achiever
MCSD
 
B

BobG

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!
 

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

No members online now.

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top