起步软件技术论坛-X3

 找回密码
 立即注册
搜索
查看: 833|回复: 20

【结贴】关于webservices生成dll控件问题

[复制链接]
发表于 2010-6-8 12:54:30 | 显示全部楼层 |阅读模式
我是用delphi7生成的一个webservices的dll,能直接引用吗?我这里没有dilphi6的环境,按论坛里的《如何在X3中引入外部控件.pdf》的操作在第三步时就出错,无法继续下去。
回复

使用道具 举报

 楼主| 发表于 2010-6-8 12:55:44 | 显示全部楼层
直接用了delphi7的这个dll,会出错:
在装载模块“File:\D:\Program Files\justep\X3 Developer 3108\lib\SMAlarmWebservices.dll”的时候出现错误:Assertion failure (E:\DEVELOP\BUILD_MOSTNEW\TIB3\SRC_PROTECTED\COMMONLANGUAGE\Metadata\CLIMDAccess.pas, line 1186),可能是文件内容有误。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-6-8 13:00:00 | 显示全部楼层
delphi7生成的webservices的pas文件,编译是通过的,但在生成注册文件时就进行不下去。

提示“Access violation at address 004BE4FC in module 'DelphiImporter.exe'. Read of address 00000000”

这类错误。
回复 支持 反对

使用道具 举报

发表于 2010-6-8 13:14:16 | 显示全部楼层
必须是 d6+sp2的环境去 做第三方控件。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-6-8 14:07:10 | 显示全部楼层
装了delphi6还是不行,运行生成注册文件时还是出错。

Access violation at address 004BE5D4 in module 'DelphiImporter.exe'. Read of add
ress 00000000

文件我已经参照DEMO做了,搞不懂了
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-6-8 14:08:56 | 显示全部楼层
而且,编译的时候,最后的
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(SMAlarmZjjcnt), '');
这段话在delphi6里通不过,没这个方法,奇怪了
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-6-8 16:18:08 | 显示全部楼层
我用d6写了个窗口,能使用这个webservices接口,调用返回结果都正常的,
但把这个pas文件拿去生成注册文件时,还是出错,
Access violation at address 004BE5D4 in module 'DelphiImporter.exe'. Read of add
ress 00000000
回复 支持 反对

使用道具 举报

发表于 2010-6-8 16:23:41 | 显示全部楼层
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-6-8 16:53:07 | 显示全部楼层
Unit SMAlarmServices;

interface

uses Types, XSBuiltIns;
type

  SMAlarmZjjcnt = interface(IInvokable)
    ['{CD7C80A1-9174-4784-9C4D-FFF52CE7EFE3}']
    procedure SMAlarm(const phoneNumbers: string; const msg: string; out SMAlarmReturn: Integer);  stdcall;
  end;

  function GetSMAlarmZjjcnt(UseWSDL: Boolean; Addr: string): SMAlarmZjjcnt;
implementation
uses InvokeRegistry, SOAPHTTPClient;

function GetSMAlarmZjjcnt(UseWSDL: Boolean; Addr: string): SMAlarmZjjcnt;
const
  defWSDL = 'http://127.0.0.1:7001/wjweb/services/SMAlarmZjjcnt?wsdl';
  defURL  = 'http://127.0.0.1:7001/wjweb/services/SMAlarmZjjcnt';
  defSvc  = 'SMAlarmZjjcntService';
  defPrt  = 'SMAlarmZjjcnt';
var
  RIO: THTTPRIO;
begin
  Result := nil;
  if (Addr = '') then
  begin
    if UseWSDL then
      Addr := defWSDL
    else
      Addr := defURL;
  end;
  RIO := THTTPRIO.Create(nil);
  RIO.HTTPWebNode.UseUTF8InHeader := True;
  try
    if UseWSDL then
    begin
      RIO.WSDLLocation := Addr;
      RIO.Service := defSvc;
      RIO.Port := defPrt;
    end else
      RIO.URL := Addr;
      Result := (RIO as SMAlarmZjjcnt);
  finally
    if Result = nil then
      RIO.Free;
  end;
end;


initialization
  InvRegistry.RegisterInterface(TypeInfo(SMAlarmZjjcnt), '', 'UTF-8');
  //InvRegistry.RegisterDefaultSOAPAction(TypeInfo(SMAlarmZjjcnt), 'http://tempuri.org/HelloWorld');
  //InvRegistry.RegisterInvokeOptions(TypeInfo(SMAlarmZjjcnt),ioDocument);


end.
回复 支持 反对

使用道具 举报

发表于 2010-6-8 17:08:08 | 显示全部楼层
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2025-7-8 19:43 , Processed in 0.038517 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表