Solved

Error in Sql Server 2005 Webservice --Client found response content type of 'text/html', but expected 'text/xml'

Posted on 2007-03-30
3
1,949 Views
Last Modified: 2009-02-03
Hi,
I have a asp.net web page which has 3 dropdown list and a radio button plus a button.User select relevant values from the dropdowns,check the radio button if needed and click go button.Actually it calls a Sql server 2005 Reportiing web service and passes the parameters using this web service and renders report.But,im having problem rendering this report....i want to render in pdf format ....and heres my code
private void btnGO_Click(object sender, System.EventArgs e)
{
    GetReport();
}
 
private void GetReport()
{
     ReportExecutionService rsExec = GetReportExecutionService();
     bool forRendering = false;
     string extension = string.Empty;
     string mimeType = string.Empty;
     string encoding = string.Empty;
     string[] streamIDs = null;
     Web.ReportExecution2005.Warning[] warnings = null;
     string reportName = ConfigurationSettings.AppSettings["ReportExecution2005.ReportsFolder"] + "/" +"Report"+ ddlReport.SelectedItem.Text;
  Response.ContentType = "application/pdf";
  Response.AddHeader("content-disposition", "attachment;filename=" + ddlReport.SelectedItem.Text + ".pdf");
  rsExec.LoadReport(reportName,null); //here where i hit the problem
  Web.ReportExecution2005.ParameterValue[] parameters = new Web.ReportExecution2005.ParameterValue[4];
  parameters[0] = new Web.ReportExecution2005.ParameterValue();
  parameters[0].Label = "clientId";
 parameters[0].Name = "clientId";
 if(!chkByT.Checked)
{
    parameters[0].Value = 1
}
else
{
       parameters[0].Value = "-1";
}
                  
parameters[2] = new Web.ReportExecution2005.ParameterValue();
parameters[2].Label = "Year";
parameters[2].Name = "Year";
parameters[2].Value = ddlYear.SelectedItem.ToString();
parameters[3] = new Web.ReportExecution2005.ParameterValue();
parameters[3].Label = "Qtr";
parameters[3].Name = "Qtr";
parameters[3].Value = ddlQtr.SelectedValue.ToString();
parameters[4] = new Web.ReportExecution2005.ParameterValue();
parameters[4].Label = "Annual";
parameters[4].Name = "Annual";
if(radYearly.Checked)
{
     parameters[4].Value = "1";
}
else
{
      parameters[4].Value = "0";
}
 rsExec.SetExecutionParameters(parameters,"en-us");
 Byte[] bytes = rsExec.Render("PDF",null,out extension,out mimeType,out encoding,out warnings,out streamIDs);
Response.BinaryWrite(bytes);
Response.Flush();
Response.End();
}
and the error im getting is
Client found response content type of 'text/html', but expected 'text/xml'. The request failed with the error message: -- <html><head><title>Error</title></head><body>The specified procedure could not be found. </body></html> --.

            
0
Comment
Question by:aspnetdev
3 Comments
 
LVL 4

Expert Comment

by:eozz_2000
ID: 18827165
What happen if you clear the headers of your page before assiginng "application/pdf"?
0
 
LVL 10

Expert Comment

by:RichardCorrie
ID: 18839648
hmm; reading the error message returned
>> The specified procedure could not be found <<
implies that a procedure that the report is based on/uses is not in the database??!!

put some try ... catch statements round rsExec.Render to see if that is place where code fails.

/Richard
0
 

Accepted Solution

by:
aspnetdev earned 0 total points
ID: 20557348
Admin you can go ahead and close this question
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ASP.NET e-commerce website 4 55
Cannot upload files above 1mb IIS7 11 39
Runtime Exceptions when trying to submit data 28 36
Why is some text in blue in Visual Studio? 6 22
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now