in Search

Hints, Tips and Tricks

Technical Hints Tips and Tricks that cover customization and development using Sage CRM. API usage and coding are covered.

WebServiceSoapClient() vs WebService() or (Add Service Reference vs Add Web Reference)

As I noted in my earlier article (Visual Studio 2008 and Sage CRM Web Services) if you are using Visual Studio 2008 then it is perfectly possible to continue to use the Add Web Reference way of working.  And it is up to you which way you choose to code.

If you have used 'Add Service Reference' to connect to a CRM install then you will be using the WebServiceSoapPort class.  Below are just 2 examples of how the code will differ.

Log on (WebServiceSoapClient)

WebServiceSoapPort CRMService = new WebServiceSoapPortClient();
logonRequest crmLogonRequest = new logonRequest();
crmLogonRequest.username = "Admin";
crmLogonRequest.password = "P455w0rd";
logonResponse CRMLogon = CRMService.logon(crmLogonRequest);

SessionHeader crmSessionHeader = new SessionHeader();
crmSessionHeader.sessionId = CRMLogon.result.sessionid;

Logon (WebService)

WebService CRMService = new WebService();
logonresult CRMLogon = CRMService.logon("Admin", "P455w0rd");

CRMService.SessionHeaderValue = new SessionHeader();
CRMService.SessionHeaderValue.sessionId = CRMLogon.sessionid;

Logoff (WebServiceSoapClient)

logoffRequest crmLogoffRequest = new logoffRequest();
crmLogoffRequest.SessionHeader = crmSessionHeader;
crmLogoffRequest.sessionId=CRMLogon.result.sessionid;
logoffResponse crmLogoff = CRMService.logoff(crmLogoffRequest);

Logoff (WebService)

CRMService.logoff(CRMService.SessionHeaderValue.sessionId);

 

Comments

No Comments

About Jeff Richards

As the Head of Training Program Development for Sage Technologies, I am responsible for providing the technical education for the Sage CRM Development Partner community. I write and present regularly on Sage CRM development techniques, hints and tips. I also provide education and training for the staff of local Sage companies in new technical features and act as a resource for Sage trainers as they develop their training courses. I have been working with Sage CRM since early 2001 (version 2.85) and I have a thorough understanding of the issues faced by partners carrying out implementations. I have been working within the Software Industry since 1993. I have a strong background in Business Rules and Workflow.

News

To help you find information quickly, use the tag cloud on the righthand side of the page. Every article and file posted is marked with one or more tags. The tags are mainly single words and are listed alphabetically. The more frequently a tag has been used to mark an article the bigger it will appear in the cloud. The tags are hyperlinks that lead to a collection of items that are associated with a tag. To find an article that discusses creating XML feeds using ASP pages, click on ASP, then on the next page click on XML.

This Blog

Syndication

sagecrm.com Articles