XE2 WebServices变量申请后不能用,D6可以
时间:2011-12-01
来源:互联网
XE2 WebServices变量申请后不能用,D6可以
报错代码:raised exception class $C0000005 with message 'access violation at 0x004cc1f6: read of address 0x180012f3'.
下面是引入的WDSL单位.
unit GetOrdersService;
interface
uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;
type
Materiel = class;
Materiel = class(TRemotable)
private
Fimage: TByteDynArray;
FimageName: string;
FmaterielName: string;
Fnumber: Double;
Fprice: Double;
Fuid: string;
published
property image: TByteDynArray read Fimage write Fimage;
property imageName: string read FimageName write FimageName;
property materielName: string read FmaterielName write FmaterielName;
property number: Double read Fnumber write Fnumber;
property price: Double read Fprice write Fprice;
property uid: string read Fuid write Fuid;
end;
GetOrdersServiceImpl = interface(IInvokable)
['{28E2C1A5-4D71-7278-C81B-6B2E93EBD77B}']
function downloadOrders(const company: string): string; stdcall;
function uploadMateriels(const materiels: Materiel): Boolean; stdcall;
end;
function GetGetOrdersServiceImpl(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): GetOrdersServiceImpl;
implementation
uses SysUtils;
function GetGetOrdersServiceImpl(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): GetOrdersServiceImpl;
const
defWSDL = 'http://192.168.0.243:8080/saas/services/GetOrdersService?wsdl';
defURL = 'http://192.168.0.243:8080/saas/services/GetOrdersService';
defSvc = 'GetOrdersServiceImplService';
defPrt = 'GetOrdersService';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
if HTTPRIO = nil then
RIO := THTTPRIO.Create(nil)
else
RIO := HTTPRIO;
try
Result := (RIO as GetOrdersServiceImpl);
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end else
RIO.URL := Addr;
finally
if (Result = nil) and (HTTPRIO = nil) then
RIO.Free;
end;
end;
initialization
{ GetOrdersServiceImpl }
InvRegistry.RegisterInterface(TypeInfo(GetOrdersServiceImpl), 'http://impl.service.government.com.sasp', 'UTF-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(GetOrdersServiceImpl), '');
RemClassRegistry.RegisterXSClass(Materiel, 'http://biz.orm.sasp', 'Materiel');
end.
程序,按钮单击事件.
procedure TMainFrm.Button10Click(Sender: TObject);
var
ss:Materiel;
begin
ss.uid:='300'; //这里就报错了
ss.price:=105.33;
if (HTTPRIO1 as GetOrdersServiceImpl).uploadMateriels(ss) then
ShowMessage('Sucess!')
else
ShowMessage('False!');
end;
下面是报错代码:
raised exception class $C0000005 with message 'access violation at 0x004cc1f6: read of address 0x180012f3'.
报错代码:raised exception class $C0000005 with message 'access violation at 0x004cc1f6: read of address 0x180012f3'.
下面是引入的WDSL单位.
unit GetOrdersService;
interface
uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;
type
Materiel = class;
Materiel = class(TRemotable)
private
Fimage: TByteDynArray;
FimageName: string;
FmaterielName: string;
Fnumber: Double;
Fprice: Double;
Fuid: string;
published
property image: TByteDynArray read Fimage write Fimage;
property imageName: string read FimageName write FimageName;
property materielName: string read FmaterielName write FmaterielName;
property number: Double read Fnumber write Fnumber;
property price: Double read Fprice write Fprice;
property uid: string read Fuid write Fuid;
end;
GetOrdersServiceImpl = interface(IInvokable)
['{28E2C1A5-4D71-7278-C81B-6B2E93EBD77B}']
function downloadOrders(const company: string): string; stdcall;
function uploadMateriels(const materiels: Materiel): Boolean; stdcall;
end;
function GetGetOrdersServiceImpl(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): GetOrdersServiceImpl;
implementation
uses SysUtils;
function GetGetOrdersServiceImpl(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): GetOrdersServiceImpl;
const
defWSDL = 'http://192.168.0.243:8080/saas/services/GetOrdersService?wsdl';
defURL = 'http://192.168.0.243:8080/saas/services/GetOrdersService';
defSvc = 'GetOrdersServiceImplService';
defPrt = 'GetOrdersService';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
if HTTPRIO = nil then
RIO := THTTPRIO.Create(nil)
else
RIO := HTTPRIO;
try
Result := (RIO as GetOrdersServiceImpl);
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end else
RIO.URL := Addr;
finally
if (Result = nil) and (HTTPRIO = nil) then
RIO.Free;
end;
end;
initialization
{ GetOrdersServiceImpl }
InvRegistry.RegisterInterface(TypeInfo(GetOrdersServiceImpl), 'http://impl.service.government.com.sasp', 'UTF-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(GetOrdersServiceImpl), '');
RemClassRegistry.RegisterXSClass(Materiel, 'http://biz.orm.sasp', 'Materiel');
end.
程序,按钮单击事件.
procedure TMainFrm.Button10Click(Sender: TObject);
var
ss:Materiel;
begin
ss.uid:='300'; //这里就报错了
ss.price:=105.33;
if (HTTPRIO1 as GetOrdersServiceImpl).uploadMateriels(ss) then
ShowMessage('Sucess!')
else
ShowMessage('False!');
end;
下面是报错代码:
raised exception class $C0000005 with message 'access violation at 0x004cc1f6: read of address 0x180012f3'.
作者: ftwsnow 发布时间: 2011-12-01
已解决,
ss:=Material.create;
ss:=Material.create;
作者: ftwsnow 发布时间: 2011-12-02
记得
ss.free
ss.free
作者: wade520 发布时间: 2011-12-02
我保留记录
作者: tiankun66 发布时间: 2011-12-02
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28