Creating a Web Reference using Visual Studio 2008
To use the Centershift STORE Web Service, you must create a Web Reference to it in Visual Studio.
- Open a current project in Visual Studio, or create a new one.
- Right click on the Service References node in the Solution Explorer Window, and click “Add Service Reference”.
A form titled “Add Service Reference” will open.

- Type in the following URL into the “Address” field at the top and click “Go”.
Development Links:
- WCF: https://store.centershift.com/sandbox40/SWS.svc
- SOAP: https://store.centershift.com/sandbox40/SWS.asmx
- WSDL: https://store.centershift.com/sandbox40/SWS.svc?WSDL
Production Links:
- WCF: https://store.centershift.com/Store40/SWS.svc
- SOAP: https://store.centershift.com/Store40SWS.asmx
- WSDL: https://store.centershift.com/Store40/SWS.svc?WSDL
- Give the Web Service a namespace in the textbox labeled “Namespace”.
- Click “OK”. The Web service is now available for consumption, and ready for the function calls described in this documentation.
You can now see all of the methods available through the STORE Web Services in the web references section of your Solution Explorer.
Using the STORE Web Services as Objects
You will still need a web reference in your project as described above.
The following VB and C# code shows how to create objects and call a sample method:
Visual Basic Example (WCF):
'++++USE THIS CODE IF YOU HAVE NOT SET A REFERENCE AT THE PROJECT LEVEL
'Initialize the web service binding
Dim objBinding As New System.ServiceModel.BasicHttpBinding
objBinding.Security.Mode = ServiceModel.BasicHttpSecurityMode.Transport
objBinding.MaxReceivedMessageSize = Integer.MaxValue
'Initialize the web service proxy using the binding and the given endpoint address
objService = System.ServiceModel.ChannelFactory(Of ServiceReference1.WS).CreateChannel(objBinding, New System.ServiceModel.EndpointAddress("https://store.centershift.com/Sandbox40/SWS.svc "))
'+++++
'*****USE THIS CODE IF YOU SET A REFERENCE AT THE PROJECT LEVEL
Dim objService as New [Your Reference Name].WSSoapClient("WSSoap")
'*****
' Create and set authentication credentials
Dim objLogin As New StoreWebServices.LookupUser_Request
With objLogin
.Username = "Username"
.Password = "Password"
.Channel = 999
End With
' Create the request object
Dim objReq As New StoreWebServices.UpdateRental_Request
' Set required parameters
With objReq
.RentalId = 123456
.MoveOutDate = "01/01/2010"
End With
' Create a response object
Dim objRes As New StoreWebServices.UpdateRental_Response
Try
' Call the method that will load the response object
objRes = objService.UpdateRental(objLogin, objReq)
' Bind your result data to object
Me.DataGridView1.DataSource = objRes.Details
Me.DataGridView1.Refresh()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
C# Example (SOAP):
//Create the main Web Services object
SWS.WS ws = new SWS.WSClient();
//Create and set the authentication credentials
SWS.LookupUser_Request lookupUser = new SWS.LookupUser_Request();
lookupUser.Username = "Username";
lookupUser.Password = "Password";
lookupUser.Channel = 1;
//Create the method's request object
SWS.GetPrimaryRentalInfo_Request request = new SWS.GetPrimaryRentalInfo_Request();
//Set required parameters
request.AccountID = 123;
request.SiteID = 1234;
//Create the method's response object
SWS.GetPrimaryRentalInfo_Response response;
try
{
//Call the method and set its value to the response object
response = ws.GetPrimaryRentalInfo(lookupUser, request);
foreach (SWS.SOA_GET_PRIMARY_RENTAL_INFO thisres in response.Details)
{
MessageBox.Show(thisres.ACCT_NAME);
}
}
catch
{
//Error handling here.
}
The first step is to create a new WS object. This will correspond to the name that you specified when creating your web method.
//Create the main Web Services object
SWS.WS ws = new SWS.WSClient();
The basic concept is an object orientated approach of creating a request object, setting the parameters of this request, calling the method and loading the results into a response object.
The response will usually be a collection of data that can be bound to display objects.
Each method call requires authentication and takes as parameter a login object which contains a username and password.
You can create this object once and pass this into all methods you call.
//Create and set the authentication credentials
SWS.LookupUser_Request lookupUser = new SWS.LookupUser_Request();
lookupUser.Username = "Username";
lookupUser.Password = "Password";
lookupUser.Channel = 1;
You then create a request object and set any required parameters.
The required parameters are specified for each method in this document.
The method will also give you an error message if all required parameters are not set.
//Create the method's request object
SWS.GetPrimaryRentalInfo_Request request = new SWS.GetPrimaryRentalInfo_Request();
//Set required parameters
request.AccountID = 123;
request.SiteID = 1234;
Now create the response object and call the desired method passing in this login object and the request object.
try
{
//Call the method and set its value to the response object
response = ws.GetPrimaryRentalInfo(lookupUser, request);
foreach (SWS.SOA_GET_PRIMARY_RENTAL_INFO thisres in response.Details)
{
MessageBox.Show(thisres.ACCT_NAME);
}
}
catch
{
//Error handling here.
}
Always use error handling to catch any problems with your method call.
Each SWS method will throw specific error messages to help verify the correct data is passed in.
For help with "unknown errors" please contact a SWS representative.
This is the basic methodology of all SWS methods.
This Sample code is provided to show you how a SWS method should be called. Each method has the possibility of variations.