Programmer's Guide (Supporting ADX v03.1.00) Manual

836 Brocade Virtual ADX XML API Programmer’s Guide
53-1003248-01
Example - Provisioning real and virtual servers
B
//
// Parameters: -
//
/////////////////////////////////////////////////////////////////////////////
public class SlbService : AdcSlb
{
private String m_HeaderName;
private String m_HeaderValue;
/////////////////////////////////////////////////////////////////////////////
// Name: GetWebRequest
//
// Description: Called by the SOAP client class library, GetWebRequest
will
// add to the underlying request used by the SOAP client when
// making the web method call
//
// Parameters: Uri - the webservice url
//
/////////////////////////////////////////////////////////////////////////////
protected override WebRequest GetWebRequest(Uri uri)
{
// call the base class to get the underlying WebRequest object
HttpWebRequest req = (HttpWebRequest)base.GetWebRequest(uri);
if (null != this.m_HeaderName)
{
// set the header
req.Headers.Add(this.m_HeaderName, this.m_HeaderValue);
}
// return the WebRequest to the caller
return (WebRequest)req;
}
/////////////////////////////////////////////////////////////////////////////
// Name: SetRequestHeader
//
// Description: Sets the header name and value that GetWebRequest will add
to
// the authorization header to the outgoing webrequest.
//
// Parameters: headerName - The Authorization tag. headerValue - the
encrypted
// username and password
/////////////////////////////////////////////////////////////////////////////
public void SetRequestHeader(String headerName, String headerValue)
{
this.m_HeaderName = headerName;
this.m_HeaderValue = headerValue;
}
}
/////////////////////////////////////////////////////////////////////////////
// Name: Utils
//
// Description: Utils class is the utility class with singleton functionality
// which contains common functionalities which is being used in
// more than one class
//
// Parameters: -