- wsaltroute.zip
- WSAltRoute
- AsyncUIHelper
- Bin
- Client
- Images
- CD.gif
- Help.gif
- Server
- WSQSetup.exe
- POCColour
- bin
- Debug
- EqosBinaryHelper
- LateBoundVBTest
- obj
- Scraps
- Web References
- C24ColourService0603
- C24ColourService2602
- WebSites
- WSAltRoute
- WSAltRouteWSE
- WSAltQSetup
- App.ico
- AssemblyInfo.cs
- bin
- Debug
- WSQSetup.exe
- WSQSetup.pdb
- obj
- Debug
- temp
- TempPE
- WSQSetup.exe
- WSQSetup.exe.incr
- WSQSetup.pdb
- WSQSetup.projdata
- WSQSetup.projdata1
- MQAX200.dll
- QSetupDriver.cs
- WSQSetup.csproj
- WSQSetup.csproj.user
- WSSetupMQ
- WSAltRoute.sln
- WSAltRoute.suo
- WSAltRouteDemo.snk
- WSAltRoutePerfTest
- bin
- Debug
- obj
- Web References
- C24ColourService0603
- C24ColourService0603WSE
- C24ColourService1703Perf
- WSAltRouteTest
- WSAltRouteTestForm
- bin
- Debug
- Release
- obj
- Debug
- temp
- TempPE
- Release
- temp
- TempPE
- Web References
- C24ColourService0603
- C24ColourService0603WSE
- C24ColourService0702
- C24ColourService0702WSE
- C24ColourService2201
- WSAltTransports
- WSDLfromC24
- 20030122
- Test
- 20030207
- 20030226
- 20030306
- WSDLfromJT
- wsaltroute_src.zip
|
using System;
using System.Net;
using System.Web.Services.Protocols;
namespace WSAltRouteTest
{
/// <summary>WSAltRouteTest.ProxyCommon</summary>
/// <author>SGregory</author>
/// <date>16 January 2003</date>
/// <remarks>
/// Some shared functions for the Proxy classes. This means that
/// several generated proxies e.g. localhost1, localhost2 etc. can all
/// share these routines.
/// </remarks>
internal class ProxyCommon
{
public ProxyCommon()
{
}
/// <summary>WSAltRouteTest.ProxyCommon.GetWebRequest</summary>
/// <author>SGregory</author>
/// <date>16 January 2003</date>
/// <remarks>
/// Called from the overridden GetWebRequest within the generated WS proxy.
/// This method checks for specific protocols we support and registers it
/// if needs be. For Uri's sarting "http://", etc. no registration is required -
/// the specific WebRequest instance can just be created.
/// </remarks>
/// <param name="uri" type="System.Uri">The Uri the call involves</param>
/// <param name="client" type="System.Web.Services.Protocols.SoapHttpClientProtocol">The caller (generated proxy)</param>
/// <returns type="System.Net.WebRequest">The cast base class version of the specific protocol handler.</returns>
/// <preconditions>
/// Uri scheme (protocol) is either already known (e.g. "HTTP://" and hence does not
/// need to be registered, or is a supported custom one - like MQ:// or MSMQ:// in our case.
/// </preconditions>
/// <postconditions></postconditions>
static public WebRequest GetWebRequest(
Uri uri,
SoapHttpClientProtocol client)
{
// Check for any custom Uri's we support.
// We need to register the custom ones
if (uri.AbsoluteUri.ToLower().IndexOf("msmq:") == 0)
{
// Register the "msmq:" prefix here for WebRequest
MSMQRequestCreator Creator = new MSMQRequestCreator();
WebRequest.RegisterPrefix("msmq", Creator);
}
else
if (uri.AbsoluteUri.ToLower().IndexOf("mq:") == 0)
{
// Register the "mq:" prefix here for WebRequest
MQRequestCreator Creator = new MQRequestCreator();
WebRequest.RegisterPrefix("mq", Creator);
}
// Create a WebRequest dependent on URI scheme
// Note - if we get here, we're in one of 3 modes:
//
// 1) We are a Uri with well known scheme e.g. http://
// 2) We are a Uri not so well known but we've been registered above e.g. msmq://
// 3) We are a Uri even less well known e.g. mailto: and are not supported.
// In this 3rd case, the following call to WebRequest.Create() will fail
// with "Uri scheme not supported" or similar.
//
// This next call against the WebRequest base class forces the IWebRequestCreate
// interface to be called for the relevant scheme.
WebRequest newWebRequest = WebRequest.Create(uri);
// If we get here, pass the callers wait timeout (in secs)
newWebRequest.Timeout = client.Timeout;
// If it's a known custom Uri, set up the caller for use later
// we need this to allow the MSMQWebRequest / MQWebRequest to get at the
// serialised Soap message in order to send it to the target.
if (uri.AbsoluteUri.IndexOf("msmq:") == 0 ||
uri.AbsoluteUri.IndexOf("mq:") == 0)
((MyBaseWebRequest)newWebRequest).CallingProxy = (MySoapClientProtocol)client;
// Return the specific WebRequest instance
return newWebRequest;
}
/// <summary>WSAltRouteTest.ProxyCommon.GetWebResponse</summary>
/// <author>SGregory</author>
/// <date>17 January 2003</date>
/// <remarks>Invokes the WebResponse logic of the specific protocol handler</remarks>
/// <param name="webReq" type="System.Net.WebRequest">Specific WebRequest handler e.g. MSMQWebRequest</param>
/// <returns type="System.Net.WebResponse">Specific WebResponse object</returns>
static public WebResponse GetWebResponse(
WebRequest webReq)
{
try
{
// Ask for a response for the request
return webReq.GetResponse();
}
catch(Exception e)
{
// This is here simply to allow the debug IDE to observe it
throw e;
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
I am the Technical Director for Myphones.com, which specialises in developing integrated VoIP products and services for the consumer and SME markets. Technology-wise, we are heavily into the 2nd generation WS stack atop .NET, and basically most things Microsoft, as well as C++ on Linux.