How to Logon / Logoff using Web Service in Sage CRM and Add Service Reference?

by Raju Maharjan 30. November 2010 19:08

If you have used 'Add Service Reference' to connect to a Sage CRM with VS2008 then you will be using the WebServiceSoapPort class. Before beginning with the development firstly add reference to the web service by simply right clicking the project solution explorer and then Add Service Reference. The below window appears and put you reference URL.

How to Logon using Web Service in Sage CRM and Add Service Reference?

 

Log on (WebServiceSoapClient)

WebServiceSoapPort SageCRMService = new WebServiceSoapPortClient();
logonRequest objLogonRequest = new logonRequest();

//Set your CRM Username and Password
objLogonRequest .username = "CRMAdminUser";
objLogonRequest .password = "yourCrmPassword";
logonResponse objLogonResponse = SageCRMService .logon(objLogonRequest );

SessionHeader objSessionHeader = new SessionHeader();
objSessionHeader.sessionId = objLogonResponse .result.sessionid;

Log off (WebServiceSoapClient)

logoffRequest objLogoffRequest = new logoffRequest();

objLogoffRequest .SessionHeader = objSessionHeader;
objLogoffRequest .sessionId=objLogonResponse .result.sessionid;
logoffResponse objLogoff = SageCRMService.logoff(objLogoffRequest);

By implementing in code as above you will be able to Logon and LogOff in SageCRM. The steps are pretty simple to use but make sure that the logon user must have Web Service access and CRM Web Services are setup.

To set up a user for Web Services:

1. Select Administration | Users | Users and find the user who you want to be able to access

Web Services.

2. Select the hypertext link for the user and select the Change action button.

3. Scroll down to the Security Profile panel, set the Allow Web Service Access field to True.

4. Select the Save button.

 

Domain Registration, Web Hosting and Web Services 
Domain Registration, Web Hosting and Reseller Web Hosting 
Start Web Hosting from just $2.5/Month

Comments

Add comment


() (Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading




Sapnep IT Solution

We Provide IT solutions and services to deliver a unique blend of real-business experience with a strong engineering, international project delivery. We are a software development  firm.