Question

My code works great but I would like to set some comments to the parameters variables of the functions.

$server->register(
    // method name:
    'getCustomerExists',         
    // parameter list:
    array('byWhat' => 'xsd:string'), 
    // return value(s):
    array(),
    $namespace,
    false,
    'rpc',
    'encoded',
    // description: documentation for the method
    'Retrieve customer by Email OR Identification Number.
     @byWhat = String'); 

function getCustomerExists($byWhat){
    return $web->getCustomerExists($byWhat);
}

And for this test I'm using Visual C# Express. So when I type my function, this is what popup as a help: enter image description here

Unless people read the documentation they won't know what "byWhat" is.

What I'm searching for is that parameter comment Visual C# gives in their functions. enter image description here

I have tried this solution without success.

Was it helpful?

Solution

You can add comments in your C# code that will appear as help text:

/// <summary>
/// 
/// </summary>
/// <param name="someArgument">Description</param>
public void SomeMethod(string someArgument)
{

}

Here, "Description" will be the helpt text for the param named someArgument.

Edit, note:

I just realized you seem to be talking about a web service - if so, this might not be applicable. Since a web service is defined by XML, and the code you use for the client side is automatically generated, the comments from your code will not be included.

Silly-hack PS:

You may be able to edit the generated classes, and add comments there (that can be done in C#, and I would assume it should work in PHP too), but unless you know you are never going to change or update your service interface, it's a pretty lousy solution because:

  • it requires adding everything manually on the client side code that was generated, and
  • all comments will disappear every time the code is updated.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top