The report does not reflect the locale setting of the client computer when you render a report in the SQL Server 2005 Reporting Services Web service or in the SQL Server 2000 Reporting Services Web service (919153)



The information in this article applies to:

  • Microsoft SQL Server 2005 Reporting Services
  • Microsoft SQL Server 2000 Reporting Services

SYMPTOMS

In the Microsoft SQL Server 2005 Reporting Services Web service or in the Microsoft SQL Server 2000 Reporting Services Web service, you render a report by using the Render method. When you do this, the report does not reflect the locale setting of the client computer.

For example, if you use the User!Language expression in a report, the value of the expression is not set to the locale setting of the client computer.

Note For backward compatibility, the Web service that is provided in SQL Server 2000 Reporting Services is still provided in SQL Server 2005 Reporting Services. You can access this Web service by using the following URL:

http://myserver/reportserver/reportservice.asmx?wsdl

In this URL, myserver is a placeholder for the name of the server that is running the report server.

CAUSE

This problem occurs because the Accept-Language HTTP response header is not transmitted when the Web service sends the SOAP requests to the Reporting Services Web server.

RESOLUTION

To resolve this problem, specify the Accept-Language HTTP response header by overriding the GetWebRequest function. To do this, follow these steps:
  1. Locate the folder of the Microsoft Visual Studio project that you created to render the report.
  2. In a text editor, open the Reference.cs file or the Reference.vb file.

    Note These files are in the ProjectName\Web References\WebReferenceName folder.
  3. In the Reporting Services Web service proxy class that is defined in the Reference.cs file or in the Reference.vb file, add the following code.

    Microsoft Visual C#

    protected override WebRequest GetWebRequest(Uri uri) {
        HttpWebRequest wr = base.GetWebRequest(uri) as HttpWebRequest;
    	   wr.Headers.Add("Accept-Language:" + System.Globalization.CultureInfo.CurrentCulture.Name);
    	   return wr;
    }
    

    Microsoft Visual Basic

    Protected Overrides Function GetWebRequest(ByVal uri As Uri) As WebRequest
          Dim wr As HttpWebRequest = TryCast(MyBase.GetWebRequest(uri),HttpWebRequest)
          wr.Headers.Add(("Accept-Language:" & System.Globalization.CultureInfo.CurrentCulture.Name))
          Return wr
    End Function
  4. At the start of the Reference.cs file or of the Reference.vb file, add a reference to the System.Net namespace.
  5. Save the project, and then rebuild the project.
Note If you create the Web service proxy by using the Web Services Description Language tool (Wsdl.exe), you must add the override function to the file that is generated by the tool.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Modification Type:MajorLast Reviewed:6/6/2006
Keywords:kbsql2005rs kbExpertiseAdvanced kbtshoot kbprb KB919153 kbAudDeveloper kbAudITPRO