SWS TerminateServiceV2 Method
Terminates a service for a specified rental item and allows the user to indicate whether any associated, unpaid service assessments should be written off.
Parameters
Name | DataType | Is Required |
---|---|---|
RemoveUnpaidAssessments | Boolean | Required |
Description | Indicates if you wish to write off the already applied service charges (“True”) or if you wish to leave them assessed to the account (“False”. | |
ServiceRentalID | Long | Required |
Description | The rental ID number of the service that will be removed. This is the RENTAL_ID parameter that is returned when using the GetAppliedServices method. | |
ServiceType | serviceTypeVals | Required |
Description | The type of service to be removed. This is the SERVICE_TYPE parameter that is returned when using the GetAppliedServices method. Available values:
|
|
SiteID | Long | Required |
Description | The site’s ID number. This can be found using the GetSiteList method. |
Returned Parameters
Name | DataType |
---|---|
Succeeded | Boolean |
Description | Indicates if the service was removed successfully (“True”) or not (“False”). |
Example
As with every method we need to pass in credentials. We do this with the LookupUser request object.
We will assume you have a web reference, let us name it SWS, in your Visual Studio project. At this point we need to define our objects. We will need the standard service object, a TerminateServiceV2 request object, and a TerminateService response object. We can define and create those like this:
// Create a request and response objects
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.TerminateServiceV2_Request request = new SWS.TerminateServiceV2_Request();
SWS.TerminateService_Response response;
Here is a sample code of the request object:
// TerminateServiceV2 Request
request.SiteID = 123456;
request.ServiceRentalID = 213456;
request.ServiceType = SWS.serviceTypeVals.GATE_ACCESS;
request.RemoveUnpaidAssessments = false;
Finally we can call the method and pass across the login object and the request object to retrieve our requested information. It’s a good idea to do this in a Try Catch block.
// Call the method that will load the response object
try
{
response = service.TerminateServiceV2(user_request, request);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Note that if something goes wrong the service will respond with an exception. You will want to capture the message in the exception so it can be debugged.
For a full list of methods see SWS Methods.
As of 04/22/2013 the SWS method TerminateServiceV2 will function correctly. The fix was a change in the underlying logic and does not change the way this SWS method is used.