nuSOAP Webservice (server)
Posted: Mon Jul 06, 2009 11:09 am
Hi,
I've been trying to find out if this is possible for a while now, but it is starting to get more pressing... Basically, I am trying to create a method that contains an optional parameter...
Here is the definition in question:
Obviously, if I call deleteActivity(1) from PHP $DeleteFuture defaults correctly, redardless of if I call the function derectly or via SOAP... However, .NET barf's as it insists that I call deleteActivity(1, 0). Up until now I have been quite happy to just document the second parameter as mandatory, however, I am at a point with a second function that I would like to add an additional parameter a function that I know is being widely used and publicly used, so don't want to cause everyone's code to fail and thus, would like to know if I can indeed specify that a given parameter is optional.
I know this can be done when defining complexTypes by changing the compositor param to "sequence" or "choice" but have not seen anything anywhere about optional parameters to functions.
Any points please, as I'm hoping I've just missed something??
I've been trying to find out if this is possible for a while now, but it is starting to get more pressing... Basically, I am trying to create a method that contains an optional parameter...
Here is the definition in question:
Code: Select all
/**
* Completely delete an activity
*
* @param int $ActivityID
* @param int $DeleteFuture
* @return int
*/
function deleteActivity ( $ActivityID, $DeleteFuture=false ) {
$ACTIVITY = new MG_activity($_SESSION['database']);
return $ACTIVITY->deleteActivity($ActivityID, $_SESSION['OrganisationID'], $DeleteFuture);
}
$server->register(
'deleteActivity',
array(
'ActivityID'=>'xsd:int'
, 'DeleteFuture'=>'xsd:int'
),
array('return'=>'xsd:int'),
$NAMESPACE,
$NAMESPACE.'#deleteActivity',
'rpc',
'encoded',
"
This will completely remove data held on the activity of the ID passed to this method.
Returns true on success.
"
);
I know this can be done when defining complexTypes by changing the compositor param to "sequence" or "choice" but have not seen anything anywhere about optional parameters to functions.
Any points please, as I'm hoping I've just missed something??