Running the DFClient under Mono
The following procedure outlines how to run the DFClient using Mono instead of the Microsoft .NET Framework. Mono is a cross platform implementation of the .NET Framework, so it can be run on non-Windows PCs and servers. To execute the DFClient using mono, we have to make a few code changes and recompile the application.
1. Install mono on your OS (see www.mono-project.com).
2. Download the DFClient source code (see developer.liebermans.net/DataFeed.aspx).
3. Unzip the source code (for this example, we will assume the code has been unzipped into C:\dfclient).
4. Copy the following files into the main code directory (C:\dfclient):
1. Reference.cs from "Web References\LiebermansServiceV2"
2. AssemblyInfo.cs from "Properties"
3. Settings.designer.cs from "Properties"
5. Edit the Reference.cs file and change the line that reads:
"public partial class LiebermansService : Microsoft.Web.Services3.WebServicesClientProtocol"
to read
"public partial class LiebermansService : System.Web.Services.Protocols.SoapHttpClientProtocol".
6. Edit the WSUtility.cs file and comment out (append "//") the following lines:
1. svc.EnableDecompression = true;
2. svc.RequireMtom = true;
7. Edit the ConsoleApplication.cs file and add the following code after "namespace DataFeedClient {"
class CerPol :
System.Net.ICertificatePolicy
{
public bool CheckValidationResult(
System.Net.ServicePoint srvPoint,
System.Security.Cryptography.X509Certificates.X509Certificate certificate,
System.Net.WebRequest request,
int certificateProblem)
{
return true;
}
}
8. Add the following line after "static void Main(string[] args) {":
System.Net.ServicePointManager.CertificatePolicy = new CerPol();
9. Edit the app.config file and:
1. Add your Web Service Credentials.
2. Delete the entry from the top of the config file that reads:
<section name=
"microsoft.web.services3" type=
"Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
3. Delete the entry from the bottom of the config file that reads:
<microsoft.web.services3>
<messaging>
<mtom clientMode="On" />
</messaging>
</microsoft.web.services3>
10. Save the app.config file and create a copy called DFClient.exe.config.
11. Using the command prompt (directory set at C:\dfclient), compile the DFClient using the command:
gmcs -out:DFClient.exe -r:System.Drawing,System.Web.Services,ICSharpCode.SharpZipLib *.cs
*Note: gmcs is the mono "generics" compiler, and it is located in the mono bin directory.
You will receive some warning messages, but the application should compile successfully at this point. Once it is compiled, you can download the data feed using the commands listed at http://developer.liebermans.net/DataFeed.aspx.
12. Run the DFClient using mono:
You must append "mono" to the beginning of your commands.
For example:
To retrieve the data feed baseline records using mono:
mono dfclient.exe -get:baseline -recordspath:c:\targetdir