做过SOAP的请进:服务模块异常俘获(200分)

Download Dunit, and take a look how they did. the code below come from dunit
function CallerAddr: Pointer;
assembler;
const
CallerIP = $4;
asm
mov eax, ebp
call IsBadPointer
test eax,eax
jne @@Error
mov eax, [ebp].CallerIP
sub eax, 5 // 5 bytes for call
push eax
call IsBadPointer
test eax,eax
pop eax
je @@Finish
@@Error:
xor eax, eax
@@Finish:
end;
 
Dunit是什么东东啊?
 
给分吧,我要
 
Dunit:Delphi的单元测试框架。你可以到https://sourceforge.net/projects/dunit
去下载其源代码
 
给分吧,我要
 
杰克,bbs-wqt:
你们要我作弊呀,那是要进黑名单的哟,嘿嘿,不干!
问题尚未解决,各位继续。
 
在服务器直接抛出异常,客户端会收得到这个异常的-----服务器不会停止
 
大海无量:
在服务器直接抛出异常,服务器是不会停止,但客户端收到的却不是这个异常,而是这种东西:
EDOMParseError
无效的 xml 声明。
Line: 3
<?xml version="1.0"?>
问题尚未解决,各位继续。
 
继续啊,富翁们!
什么意思,说我灌水?!
 
我的soap服务器中似乎客户端能得到一部分错误信息,今天我测试中发现的,但更多的是
什么“灾难性故障”
 
之前做过一个类似的:
让所有响应客户端请求的方法所属的类继承自同一基类
在这个基类中声明一个虚方法M,用于响应所有DELPHI可俘获的异常并吃掉它,
同时抛出自定义的异常类ES(包含方法名等),当子类在重载这个方法出现异常,
抛出ES的时候,是可以得到方法名的.将方法名赋给ES的成员保存起来.
再写一个处理异常ES的过程,用来返回信息给客户端.
 
sunshine1750:
在服务模块中有N多项服务,姑且认为每项服务对应一个方法。
响应客户端请求并调用相应方法应该是由THTTPSoapPascalInvoker实现的,
执行路径中并没有经过虚拟方法M,那么如何使这N多个方法发生异常时都转
由方法M来处理呢?
 
也在学习!
 
俺写的Web服务是用C#,客户端是Delphi。发现在处理中文时有问题。
要在XML的文件头中加入encoding="gb2312"才不会出错。
 
to sunsong:
要是在关闭程序时出现异常呢?
我用BDE连接数据库,在退出程序时
出现Project Project1 raise exception class EExternalException with message
'External exception C0000008'.Process stopped.
请问是什么意思?不好意思,我是初学者:D
 
procedure TWebModule_rpt.ApplicationEvents1Exception(Sender: TObject;
E: Exception);
begin
mylog := mylog + e.Message;
end;
 
type
TWebModule_rpt = class(TWebModule)
procedure TWebModule_rpt.WebModuleException(Sender: TObject;
E: Exception;
var Handled: Boolean);
begin
mylog := mylog + e.Message;
end;

procedure TWebModule_rpt.WebModule_rptWebActionItem1Action(Sender: TObject;
Request: TWebRequest;
Response: TWebResponse;
var Handled: Boolean);
begin
Response.Content := mylog;
Response.ContentType := 'text/html';
end;
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
顶部