Click here to Skip to main content
12,948,021 members (87,884 online)
Click here to Skip to main content
Add your own
alternative version


1 bookmarked
Posted 4 Jun 2012

Adding an http Security Header to Web Reference and Using Oracle CRM Stateless

, 4 Jun 2012 CPOL
Rate this:
Please Sign up or sign in to vote.
Adding an http security header to web reference and using Oracle CRM stateless


When we add a web reference in C#.NET, we don't have access to add a security header. In the case of Oracle CRM, we need to add a security header to do stateless calls.

The usual way would be to specify the service credentials but in the case of Oracle CRM, this does not work. You'll get an error Missing <wsse:Security...

The Solution

First download the Microsoft WEB SERVICES ENHANCEMENTS (WSE 2.0 or 3.0); this DLL will have the namespace that we'll need to add the functionality to the web service reference.

When you add a web reference, Visual Studio will add a reference.cs file that has all the methods available in the service. Open this file and change the inherited object from System.Web.Services.Protocols.SoapHttpClientProtocol to Microsoft.Web.Services3.WebServicesClientProtocol.

By changing the namespace, we can now add a security header and specify the user and password.

//instance of the service
CascadingPicklistService service = new CascadingPicklistService();

//Create the security tocken
UsernameToken userToken = new UsernameToken(username, password, PasswordOption.SendPlainText);

//Input and output parameters
CascadingPicklistRead_Input input = new CascadingPicklistRead_Input();
CascadingPicklistRead_Output output;

//Add the token on the service
input.CascadingPicklistSet = new CascadingPicklistSetQuery();
//Select pick lists for CRM service requests
input.CascadingPicklistSet.ObjectName = "Service Request";
output = service.CascadingPicklistRead(input);

//Select the picklist
List>PicklistValueAssociationsData< lst =
output.ListOfCascadingPicklistSet[0].ListOfCascadingPicklist.Where(prop => 
prop.ParentPicklist == "PickToSelect").
PicklistValueAssociationsData listData = 
lst.Where(pp => pp.ParentPicklistValue == parentValue).FirstOrDefault();
if (listData != null)
    return listData.RelatedPicklistValue.ToDictionary(a => a, b => b);
    //Not Found, Do your stuff


This solution will enable us to add the security header to a reference of a web service. There is one setback with this solution. Every time you update the web reference, you'll need to set the namespace in the reference.cs file. That being said, if you have worked with Oracle CRM and know a better solution to do Stateless calls on C#, let me know.


  • 6/4/2012: First draft


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Ismael Almonte
United States United States
No Biography provided

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170518.1 | Last Updated 5 Jun 2012
Article Copyright 2012 by Ismael Almonte
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid