Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > How to set SOAP values inside constructor with parameters - help

Thread Tools

How to set SOAP values inside constructor with parameters - help

Posts: n/a
Im trying to set the values for a SOAP header of a web service. The SOAP
header iscreated by calling a class file from inside the web service: See

//Web Service
public RequestAccess WSAuthorization ;
[WebMethod(Description = "Grants requests to use methods in the web service")]
[SoapHeader("WSAuthorization", Direction = SoapHeaderDirection.Out)]
public string SetCredentials(string UserName, string Password)
if (UserName.Trim() != "" & Password.Trim() != "")
//does not work - value should be "New Value" but header always says
"Initial Value" when calling subsequent methods on the service

WSAuthorization = new RequestAccess(UserName, Password);

// This retains values beteen calls but doesnt allow me to process
parameters before setting the SOAP header

WSAuthorization = new RequestAccess(); }

// Class file
public class RequestAccess : SoapHeader
public string MyToken = "";

internal RequestAccess()
MyToken = "Initial Value";

internal RequestAccess(string WSUserName, string WSPassword)
MyToken = "New Value";

If I define the SOAP header with this line MyToken is equal to "New Value"
only within the scope of the SetCredentials method. (Its not retained between
web methods in the service.

All other webmethods after this report the SOAP value as "Initial Value". It
like unless I set my values in the parameterless constructor, the values in
the header are blank for ALL web methods after the header is created. WHY

..NET Software Developer
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
skipping template parameters inside template parameters kito C++ 2 09-26-2010 12:04 AM
A constructor calling another constructor (default constructor)? Generic Usenet Account C++ 10 11-28-2007 04:12 AM
Calling constructor inside another constructor Neroku Java 8 11-18-2006 10:19 AM
trouble passing parameters of a subclass constructor through to it's superclass constructor ingoweiss Javascript 4 05-12-2006 07:43 AM