Web Service Sessions

2 minute read time.

Sage CRM's web service API allows developers to manipulate CRM records remotely. It is possible for a 3rd party application or website to access the CRM server to read, create, update, or delete records for each exposed entity, for example, Companies, People, Opportunities, Cases, Quotes and Orders.

All we need to set up Web Services is CRM installed with a standard license key. We don't need an extensibility license or a developer license. It is truly the common denominator API for Sage CRM.

The first thing to point out about web services is that it is session based. It requires authentication to be used which is associated with an individual user account.

So a 3rd party application must log on using web services as a named user within CRM. A web service session is an additional logon. So a user who is logged on through the main application interface can also have their credentials used to create a single extra web service session. Every enabled user within CRM (this excludes resources and disabled users) has the ability to have this additional session. These sessions each have their own sessionid and the logons are recorded in the Activity table within CRM.

You can also see live sessions including web service sessions using the sysadmin path.

http://[servername]/[installname]/eware.dll/sysadmin

This is discussed here.

You will need to enable each user whose credentials you need to use for a log on. This is done within the system administration screens

Administration -> Users -> Users -> [UserName]

Set the "Allow Web Service Access" flag to "True".

A user can logon once through the main interface AND once through web services.

I have discussed how you can code the logon and generate the Session ID here.

It is possible to work with web services were the user logons are normally automatic because windows authentication is used. If your system is set up to use windows authentication you may want to read the post Web Services Logon Tip.

Although the most of the examples given in the documentation, system help and these articles are in C# you can code in any language you like so long as it is capable of forming a SOAP request.

A very good tip to work with is if a 3rd application is logging via web services but not closing and logging off from CRM correctly then you should work with the idea of "Force Web service Log On" set to "True". This is because if the connection between the web service client and the service is unexpectedly broken, that client remains logged onto the server hosting the service. This means that a new instance of the client will be blocked from logging on to the server. However, if you set the "Force Web service Log On" setting to Yes, the old instance of the client is automatically logged out when a new instance attempts to log on. By forcing new log ons, this field prevents users from being "locked out" of a web service following a failed connection or unsuccessful log out.

You can control the setting of the Sage CRM webservices to use "Force Web service Log On" in the system administration screens:

Administration -> System -> Web Services

There are many articles within the site that discuss the Web Service API. For a full list of posts follow the link: https://community.sagecrm.com/tags/Web+Services/default.aspx