Using Siebel CRM On Demand Web Services in Microsoft.NET

1) Create a new windows application.

2) Put the following code in the form load

private void Form1_Load(object sender, EventArgs e)


string loginUrlString = https://servername/Services/Integration?command=login”;

String sessionID = ManageSession.Login(loginUrlString, @”orgname-devusername”, “password”);


3) Define the login method within ManageSession class in the following manner

public static string SessionID = “”;

public static String Login(String loginUrlString, String userName, String password)




// create a http request and set the headers for authentication

HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(loginUrlString);

HttpWebResponse myResponse;

myRequest.Method = “POST”;

// passing username and password in the http header

// username format if it includes slash should be the forward slash /

myRequest.Headers[“UserName”] = userName;

myRequest.Headers[“Password”] = password;

myResponse = (HttpWebResponse)myRequest.GetResponse();

Stream sr = myResponse.GetResponseStream();

// retrieve session id

char[] sep = { ‘;’ };

String[] headers = myResponse.Headers[“Set-Cookie”].Split(sep);

for (int i=0; i <= headers.Length-1; i++)


if (headers[i].StartsWith(“JSESSIONID”))


sep[0] = ‘=’;

SessionID = headers[i].Split(sep)[1];







catch (WebException webException)



catch (Exception ex)



// send back the session id that should be passed to subsequent calls

// to webservices

return SessionID;


That’s it..

Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

6 thoughts on “Using Siebel CRM On Demand Web Services in Microsoft.NET”

  1. That’s great – except SessionID is undefined in this code, as it is in the Oracle manual. A small oversight, perhaps, but shouldn’t they test this stuff before they print it?


  2. Hi Nishat,

    I am trying to use webservices in SIEBEL CRM on Demand to extract data and store it in an in-house SQL Server 2005 system.

    All I have is WSDL files that I downloaded from Siebel CRM on Demand web interface, one for every entity.

    Can you please comment on how to use these WSDL files in SQL Server 2005(and Visual Studio if required) to extract data.



  3. Hi,
    Create a new project in Visual studio it could be windows application or webapplication.
    You can select the project name, right click on it, and select add web reference, there you could pass on the location of your wsdl files. It would create a proxy class, which you can use.

    Using the proxy class first you could retrieve the values for your entities.
    And the using SqlConnection,SqlCommand object in .NET you could save it in your SQL server database.


  4. I tried it out and wrote the code using one of your articles which is;

    Now I have a main function called InsertAccount in which I am calling another function called GetAccountName which actually calls the webservice functions.

    InsertAccount just inserts the values in SQL Server using SqlCommand and SqlConnection objects.

    In GetAccountName function I have used AccountQueryPage in place of AccountUpdate as in your article.

    The first error is “the name ManageSession doesn’t exist in the current context”

    … whereas it is done exactly the same in your article at above link.

    Secondly, the line myAccUpdateInput.ListOfAccount = myLstOfAcctData; …. is giving error because the datatype of ListOfAccount in AccountQueryPage_Input is ListOfAccountQuery.

    Other than ManageSession thing, I think all I am missing is the sequence of calls.

    Please comment.


Please share your thoughts

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

CRM for You and Me

Customer Relationship Mgt App for the Professional

D CRM Explorer

Learn about Microsoft Dynamics CRM Power Platform customization and implementation and other cool stuffs

Stroke // Jonas Rapp

I know pre-stroke. I will improve who I was.

Power Melange

Power Melange By Shalinee

Clavin's Blog

Power Automate - Power Apps - SharePoint Online - Azure - Nintex - K2 - Artificial Intelligence

Sat Sangha Salon

An Inquiry in Being

The Indoencers

The Influencers & Influences of Indian Music

Monika Halan's blog

Hand's-free money management

D365 Demystified

A closer look at Microsoft Dynamics 365.

Microsoft Mate (msftmate) - Andrew Rogers

Experienced consultant primarily focused on Microsoft Dynamics 365 and the Power Platform


Specific topics by Django Lohn on the whole Microsoft365 Stack

Manmit Rahevar's Blog

One Stop Destination for Microsoft Technology Solutions


Naturally Curious

Brian Illand

Power Platform and Dynamics 365

Steve Mordue MVP

A Microsoft Business Applications MVP

Subwoofer 101

Bass defines your home theater

SQLTwins by Nakul Vachhrajani

SQL Server tips and experiences dedicated to my twin daughters.

Everything D365

Discovering Azure DevOps and D365 Business Applications

Tech Wizard

Lets do IT Spells

Two Bite Tips

Valuable Tips To Grow Your Business

XRM Tricks (Power Platform & Dynamics CRM )

Power Platform & Dynamics CRM


Mail to for queries and suggestions

Giving back to the community what I have learned

xrm CRM Dynamics

Dynamics CRM Technical & Functional Info

Dynamics 365 Blogs - Explained in unique way

Sometimes you need to look at things from different perspective.

CRM Keeper

Dynamics 365 Customer Engagement, CRM, Microsoft CRM, Dynamics CRM


Step into the world of a Dynamics 365 Consultant

Dianamics PCF Lady

Diana & Dynamics 365 & Power Platform

Sara Lagerquist

No Code Customization Concepts


developer, designer, writer, fun loving, patriotic, humble and a sweet person inside out :) love and respect people who have a great sense of humor.

Temmy Wahyu Raharjo

Dreaming to be a clean coder and TDD minded programmer.

Transform 365

We blog about problems we face and code we write to help others

%d bloggers like this: