Archive for April 23, 2011

How to send DateTime input parameter for Web Services or QaaWS using .NET C#

When we talk about Web Services then it is obvious that there is a chance where the Web Service is hosted in different geographical location than its clients. Web service hosted in a server with different timezone from its client may not return expected data if the DateTime input parameter is not properly configured/set.

Let us assume that we are trying to access a web service which is hosted in a server with different timezone as we are in. Also the service we are trying to access requires us to send input parameters of type DateTime and based on that input values server will return us some data. In my case I was trying to access a QaaWS (Query as a Web Service) service from Bangladesh (locale en_US, timezone +6 hrs) hosted in a server in Netherlands (locale nl_NL, timezone: +1 hrs) that expects two date values as input parameters along with some other parameters.

In this case to retrieve expected data from the Web Service or QaaWS service we must send the data time parameter values in the format based on our locale. So that, the server that receives that date value can convert the value based on its own timezone.

DateTime instances in C# .NET has a Kind field that indicates whether the time value is based on local time, Coordinated Universal Time (UTC), or neither. So to retrieve expected data from the Web Service we must change its kind to DateTimeKind.Local.

You can visit this for more information on DateTime.SpecifyKind().

In my case I was to send a date range for which I wanted to retrieve data. The c# code that I used to is give below.

// other codes above
DateTime fromDate = new DateTime(fromYear, fromMonth, fromDay, 0, 0, 0, 001, DateTimeKind.Local);
DateTime toDate = new DateTime(toYear, toMonth, toDay, 23, 59, 59, 999, DateTimeKind.Local);

Rows[] rows = ws.runQueryAsAService(username, password, fromDate, toDate, other, params, here);
// Other codes continued....

Leave a Comment

View ‘Market price’ from DSE BULL! Tray in Firefox

Dear DSE BULL! Tray user, you might be thinking why is the ‘Market Price’ shortcut URI is not working from DSE BULL! Tray. Actually dsebd.org is not allowing outsiders to access this resource. After my investigation on this issue I have found a workaround to view Market Price in my Firefox browser.

Please let us know if we can change referrer in other browsers too as explained below using RefControl plugin for Firefox

Follow the steps given below:

1. Download and Install Firefox if you do not have it already installed. And make Firefox as default browser.
2. Install ‘RefControl’ Firefox plugin. Please visit https://addons.mozilla.org/en-us/firefox/addon/refcontrol/ to install this plugin. Restart Firefox when asked after installation of this plugin.
3. Click Tools > ‘RefControl Options…’ to open RefContro Options window in Firefox. Click ‘Add Site’ button to open RefControl Site Properties window. Now enter ‘www.dsebd.org’ in site field, choose ‘Custom’ action and enter ‘http://dsebd.org/mkt_depth_3.php’ as shown in the screen-shot below. Click OK to close RefControl Site Properties window. Click OK again to close ‘RefControl Options’ window.

RefControl Site Properties

4. Now you are ready to view ‘Market Price’ from DSE BULL! Tray. Run DSE BULL! Tray if it is not running already. Right click any item and choose ‘Market Price…’ to view Market Price of DSE website.

Leave a Comment