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 / February 2006

Tip: Looking for answers? Try searching our database.

List parameters of the Web Service

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
hulkko123@yahoo.com - 13 Feb 2006 10:50 GMT
Hello,

Is it possible to list parameters and their types when you are using
[WebMethod (Description ()] tag or any else tag?

I couldn't find any lineseparator characters to Description attribute
when I was trying
to list parameters in hardcoded way. All parameters came is one big
line.

So, how should I list Web Methods parameteters if I like to show them
to user?
Such situations are e.g. when user or programmer pressed F5 or ctrl-F5
in Visua Studio
when the Web Service project is open and (s)he want to test Web
Service.

Any ideas?

Cheers!
Josh Twist - 13 Feb 2006 13:42 GMT
Hello,

I'm not sure I understand your question... If your WebMethod has
parameters - you'd be able to see them right there in the code?

[WebMethod]
public string SayHello(string name)
{
  return "Hello" + name;
}

They's also be visible in the WSDL and help page generated by ASP.NET
(browse to your .asmx page to see the help page, click Service
Description to see the WSDL).

Josh
http://www.thejoyofcode.com/
hulkko123@yahoo.com - 13 Feb 2006 17:12 GMT
"Problem" occurs usually when we have multisuplier projects.
Documents are usually not yet updated and we have to use other vendors
Web service methods.
It would help a lot if we would know what kind of parameter Web Service
methods excatly wants.
That would also help application programmers when they call these
methods.
Every method of course checks it parameters before it's executes so,
knowing what kind of parameter
a Service wants would help a lot (less error calls).
E.g. information considering parameters could be format, length, sets
that are valid etc. and that would help a lot.
Something like this:

[WebMethod]
[Attribute Param1 = "[0-9]{5}"]
[Attribute Param2 = "[A-Z]{10}"]
[Attribute Param3 = "(ABC)|(DEF)|(GHI)"]
public string WSMethod(string param1, string param2, string param3 ...
)
{
 // Logic coded  here
}

I don't know the syntax for this Attribute but that is the actual
question.

Cheers!
Simon Hart - 13 Feb 2006 16:48 GMT
If you mean when navigating to the .ASMX page using a browser, then append
?wsdl on the end.

Simon Hart.

> Hello,
>
[quoted text clipped - 16 lines]
>
> Cheers!
hulkko123@yahoo.com - 13 Feb 2006 17:16 GMT
Yep, that shows the wsdl but if there is business kind of rules for
parameter values
wsdl doesn't seems to help.. or are there any ways to do it using wsdl?

Cheers!
Simon Hart - 13 Feb 2006 22:44 GMT
Sorry I don't follow, business rules? do you mean documentation for
parameters, if so I don't know of any way. Web services are supposed to be
self describing.

Simon Hart.

> Yep, that shows the wsdl but if there is business kind of rules for
> parameter values
> wsdl doesn't seems to help.. or are there any ways to do it using wsdl?
>
> Cheers!
hulkko123@yahoo.com - 14 Feb 2006 19:27 GMT
So what is "self descriping"?  That is the main question. That is missing
often.
Think about e.g. Identity number of the person in Air field.
Clerk is behind desk and a foreign passanger comes.
Clerk needs to know the format of the foreign passanger.
Ok, application tells to that clerk the rigth format but the programmer
of that application must know the excat format of the Identity number that
belongs to passanger depending his/hers nationality.

How can a programmer validate it? (S)he must just know it precisely. Like I
said
in multivendor projects documentation is quite often poor so a "self
descriping"
Web Service would offer the right format by showing the format that it
expects.

What I mean is that it would be nice that C# Web Service would show to
programmer
what kind (format) parameters is wants. This is how we cut down Web Service
calls that has
parameters in wrong format.

In e.g VS.NET by pressing F5  it would be nive if we could inform the excat
format of parameters that
that Service wants, not only name of the parameter.

Am I makíng myself more clear now?

Cheers!

> Sorry I don't follow, business rules? do you mean documentation for
> parameters, if so I don't know of any way. Web services are supposed to be
[quoted text clipped - 7 lines]
>>
>> Cheers!
Josh Twist - 14 Feb 2006 21:16 GMT
The WSDL is how Web Services are self describing. The WSDL contains
information that can be read by other computers including:

The endpoint (url) of the web service
The names of methods available in the service
The names of parameters
and... information about the type of parameters and return types

It's important to note that Web Services do not share Type they share
contract (or schema) - what that means is that the WSDL contains a
representation of your Types that can be understood by any programming
language that can interpret WSDL. It's what makes web services
interoperable.

Josh
http://www.thejoyofcode.com/
Simon Hart - 15 Feb 2006 09:31 GMT
OK. So I take it you have maybe a string field or a predefined type and it
has to be in a particular format.

One way you could offer help to the programmer by the means of in-line
documentation:

/// <summary>

/// Posts the current transaction data currently held in local stack
relevant to the passed

/// terminal ID.

/// </summary>

/// <param name="termID">The terminal identifier, not be greater than 10
bytes</param>

[WebMethod (Description="Posts the passed terminal identifier data into
Equator")]

public void Post(string termID)

{

}

Something like the above will work through intellisense.

Simon.

> So what is "self descriping"?  That is the main question. That is missing
> often.
[quoted text clipped - 37 lines]
>>>
>>> Cheers!

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



©2009 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.