Webtier hang.
Hi!
Sorry to nag you about this again, but i still have some problem with report
through webtier.
I call the WebTier with this url:
http://localhost/Rapporter/WebTier/WebReport.dll?content=viewer&volume=Rapportutforsker&name=WEB\Bekreftelse_NO&newSearch=T&asg0f0se=290375&asg0f0sa=false&asg0f1se=nb-NO&asg0f1sa=false&asg0f2se=122492&asg0f2sa=false&filename=MINPDF.pdf&path=D:\BoMan\RAD2009\BDWebReport\&silent=false&
The default action is like this and it works very well with &silent = false.
procedure TwmHoved.waiDefaultAction(Sender: TObject; Request: TWebRequest;
Response: TWebResponse; var Handled: Boolean);
var
lWebRequest: TrsWebRequest;
lSilent: Boolean;
begin
lWebRequest := wtHoved.CreateWebRequest(Request.QueryFields,
Request.Content);
lSilent := lWebRequest.ContentParameters['silent'].AsBoolean;
try
try
if lSilent then
Response.Content := processConfirmationPDFRequest(lWebRequest)
else Response.Content :=
wtHoved.ProcessWebRequest(Request.QueryFields, Request.Content);
except
on E: Exception do
Response.Content := wtHoved.ErrorPageClass.CreateErrorPage(E);
end;
finally
lWebRequest.Free;
end;
end;
function TwmHoved.processConfirmationPDFRequest(aWebRequest: TrsWebRequest):
String;
var
lWebRequest: TrsWebRequest;
lClientReport: TrsClientReport;
lPath: String;
lName: String;
begin
lWebRequest := aWebRequest;
lPath := lWebRequest.ContentParameters['path'].AsString;
lName := lWebRequest.ContentParameters['filename'].AsString;
lWebRequest.ContentParameters.Remove(['path','filename','silent']);
lClientReport := wtHoved.CreateClientReport(lWebRequest);
lClientReport.ShowPrintDialog := False;
lClientReport.ShowCancelDialog := False;
lClientReport.ShowAutoSearchDialog := False;
lClientReport.DeviceType := dtPDF;
lClientReport.TextFileName := lPath+lName;
lClientReport.Print;
end;
When i set &silent=true this function is called and i attempt to use a
TrsClientReport to process the report.
The file (lPath+lName) is created but i can't open it and the browser state
is "Waiting for LocalHost".
1. Can you see any obvious errors here?
2. As the report is to be sendt as mail, should i use
lClientReport.SendMail?
Best regards,
Terje
Sorry to nag you about this again, but i still have some problem with report
through webtier.
I call the WebTier with this url:
http://localhost/Rapporter/WebTier/WebReport.dll?content=viewer&volume=Rapportutforsker&name=WEB\Bekreftelse_NO&newSearch=T&asg0f0se=290375&asg0f0sa=false&asg0f1se=nb-NO&asg0f1sa=false&asg0f2se=122492&asg0f2sa=false&filename=MINPDF.pdf&path=D:\BoMan\RAD2009\BDWebReport\&silent=false&
The default action is like this and it works very well with &silent = false.
procedure TwmHoved.waiDefaultAction(Sender: TObject; Request: TWebRequest;
Response: TWebResponse; var Handled: Boolean);
var
lWebRequest: TrsWebRequest;
lSilent: Boolean;
begin
lWebRequest := wtHoved.CreateWebRequest(Request.QueryFields,
Request.Content);
lSilent := lWebRequest.ContentParameters['silent'].AsBoolean;
try
try
if lSilent then
Response.Content := processConfirmationPDFRequest(lWebRequest)
else Response.Content :=
wtHoved.ProcessWebRequest(Request.QueryFields, Request.Content);
except
on E: Exception do
Response.Content := wtHoved.ErrorPageClass.CreateErrorPage(E);
end;
finally
lWebRequest.Free;
end;
end;
function TwmHoved.processConfirmationPDFRequest(aWebRequest: TrsWebRequest):
String;
var
lWebRequest: TrsWebRequest;
lClientReport: TrsClientReport;
lPath: String;
lName: String;
begin
lWebRequest := aWebRequest;
lPath := lWebRequest.ContentParameters['path'].AsString;
lName := lWebRequest.ContentParameters['filename'].AsString;
lWebRequest.ContentParameters.Remove(['path','filename','silent']);
lClientReport := wtHoved.CreateClientReport(lWebRequest);
lClientReport.ShowPrintDialog := False;
lClientReport.ShowCancelDialog := False;
lClientReport.ShowAutoSearchDialog := False;
lClientReport.DeviceType := dtPDF;
lClientReport.TextFileName := lPath+lName;
lClientReport.Print;
end;
When i set &silent=true this function is called and i attempt to use a
TrsClientReport to process the report.
The file (lPath+lName) is created but i can't open it and the browser state
is "Waiting for LocalHost".
1. Can you see any obvious errors here?
2. As the report is to be sendt as mail, should i use
lClientReport.SendMail?
Best regards,
Terje
This discussion has been closed.
Comments
The method processConfirmationPDFRequest needs to generate an html response
which will be returned to the browser. That is why the browser is left
hanging.
RB 12 introduced support for sending report email from the web browser. Have
you tried using that solution? Here is an rbWiki article...
http://www.digital-metaphors.com/rbWiki/General/What's_New/RB_12/Server_Enhancements
I don't know why you cannot open the file. Yes, you can use
ClientReport.SendMail. You will need to specify the email info, as described
in the above article.
-
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
i get a message that the file is not valid.
It seems that nothing happens after the ClientReport.Print other than the
creation of the pdf-file. I have run
a profiler on the sql-server but no query is ever executed from the report.
I send a html response to the browser
but it is never sent.
1. Do i have to use content=PDF in the url to make this work?
2. I have searched for a demo regarding ClientReport in a webtier, but i
find only one about ClientReport and that was very basic stuff. Do you
have any advanced demo's or tutorials regarding this? I don't intend to get
you to write this application for me, but i have been stuck with
this problems for a long time and starting to get very frustrated.
Regards,
Terje
"Nard Moseley (Digital Metaphors)" skrev i
I performed a simple test here. I added your code to the
Demos\WebTier\WebDebug example. I did not encounter any issues. I made a
couple of slight changes to what you posted, I hard coded a file name and I
hard coded a response.
Here is the code I used...
procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
lWebRequest: TrsWebRequest;
lSilent: Boolean;
begin
lWebRequest := rsWebTier1.CreateWebRequest(Request.QueryFields,
Request.Content);
lSilent := lWebRequest.ContentParameters['silent'].AsBoolean;
try
try
if lSilent then
Response.Content := processConfirmationPDFRequest(lWebRequest)
else Response.Content :=
rsWebTier1.ProcessWebRequest(Request.QueryFields, Request.Content);
except
on E: Exception do
Response.Content := rsWebTier1.ErrorPageClass.CreateErrorPage(E);
end;
finally
lWebRequest.Free;
end;
end;
function TWebModule1.processConfirmationPDFRequest(aWebRequest:
TrsWebRequest): string;
var
lWebRequest: TrsWebRequest;
lClientReport: TrsClientReport;
lPath: String;
lName: String;
begin
lWebRequest := aWebRequest;
lPath := lWebRequest.ContentParameters['path'].AsString;
lName := lWebRequest.ContentParameters['filename'].AsString;
lWebRequest.ContentParameters.Remove(['path','filename','silent']);
lClientReport := rsWebTier1.CreateClientReport(lWebRequest);
lClientReport.ShowPrintDialog := False;
lClientReport.ShowCancelDialog := False;
lClientReport.ShowAutoSearchDialog := False;
lClientReport.DeviceType := dtPDF;
lClientReport.TextFileName := 'c:\rbWebPub\Cache\test.pdf';
lClientReport.Print;
Result := ' my confirmation ';
end;
-
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
The problem was probably a timeout. The report in use has some very "heavy"
queries, and after waiting for several minutes i concluded it was a lock of
some sort. Since you made it work with the same code i had to try something
different, and so i tried a simple reeport with a simple query. And it
works.:-) Thanks a lot for your patience.
As i have your attention. Is there a way i can write to WebTier logfiles as
i can do on the reportserver?
Best regards,
Terje
"Nard Moseley (Digital Metaphors)" skrev i