soap和win2003在sp2的问题,急在线等谢谢各位大侠了!!(200分)

  • 主题发起人 主题发起人 chenhaijie_77
  • 开始时间 开始时间
C

chenhaijie_77

Unregistered / Unconfirmed
GUEST, unregistred user!
我负责写一个连接soap服务的客户端,用delphi7写的。<br>程序写好在win2003下运行,一直很好没有问题,<br>可是有一天,打了sp2补丁包后,就没能再用了,程序直到soap提供的接口dldata时报地址侵犯错误,是怎么回事呀:(
 
刚才又试了一下,在delphi2005里重编一下就没事,为什么?
 
可能是d7中的bug
 
试试在service 的接口单元中 initialization 部分<br>增加如下代码<br>InvRegistry.RegisterInvokeOptions(TypeInfo(ServiceSoap), ioDocument);<br><br>应该就可以了。如果可以,那么是d7 sp2的service调用bug
 
首先谢谢ycluo和shangshang同学<br><br>InvRegistry.RegisterInvokeOptions(TypeInfo(ServiceSoap), ioDocument);<br>这句代码我是查的大富翁加上的,但是没有用。所以才发的帖子提问。主要是用<br>dldata这个接口时就报错了。<br>下面是我的代码<br>unit UnitIExchangeData;<br><br>interface<br><br>uses InvokeRegistry, SOAPHTTPClient,usoapmain, Types, XSBuiltIns;<br><br>type<br><br>&nbsp; IExchangeData = interface(IInvokable)<br>&nbsp; ['{D3EC2EED-70F0-B447-AA38-2326B6097827}']<br>&nbsp; &nbsp; function &nbsp;DLData(const DataName: string; var DataContent: String; const Password: String; const Kddm: String; const TestDate: String): Integer; stdcall;<br>&nbsp; &nbsp; function &nbsp;UPData(const DataName: WideString; const DataContent: string; const Password: String; const Bz: String): String; stdcall;<br>&nbsp; end;<br><br>function GetIExchangeData(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): IExchangeData;<br><br><br>implementation<br><br>function GetIExchangeData(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): IExchangeData;<br>const<br>&nbsp; defSvc &nbsp;= 'IExchangeDataservice';<br>&nbsp; defPrt &nbsp;= 'IExchangeDataPort';<br>var<br>&nbsp; RIO: THTTPRIO;<br>&nbsp; defWSDL: string;<br>&nbsp; defURL: string;<br>begin<br>&nbsp; Result := nil;<br>&nbsp; defWSDL := gWSDLFile;<br>&nbsp; defURL := gWebSvrURL; <br>&nbsp; if (Addr = '') then<br>&nbsp; begin<br>&nbsp; &nbsp; if UseWSDL then<br>&nbsp; &nbsp; &nbsp; Addr := defWSDL<br>&nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; Addr := defURL;<br>&nbsp; end;<br>&nbsp; if HTTPRIO = nil then<br>&nbsp; &nbsp; RIO := THTTPRIO.Create(nil)<br>&nbsp; else<br>&nbsp; &nbsp; RIO := HTTPRIO;<br>&nbsp; try<br>&nbsp; &nbsp; Result := (RIO as IExchangeData);<br>&nbsp; &nbsp; if UseWSDL then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; RIO.WSDLLocation := Addr;<br>&nbsp; &nbsp; &nbsp; RIO.Service := defSvc;<br>&nbsp; &nbsp; &nbsp; RIO.Port := defPrt;<br>&nbsp; &nbsp; end else<br>&nbsp; &nbsp; &nbsp; RIO.URL := Addr;<br>&nbsp; finally<br>&nbsp; &nbsp; if (Result = nil) and (HTTPRIO = nil) then<br>&nbsp; &nbsp; &nbsp; RIO.Free;<br>&nbsp; end;<br>end;<br><br><br>initialization<br>&nbsp; InvRegistry.RegisterInterface(TypeInfo(IExchangeData), 'urn:ExchangeDataIntf-IExchangeData', 'utf-8');<br>&nbsp; //InvRegistry.RegisterInvokableClass(ServiceSoapImpl);<br>&nbsp; InvRegistry.RegisterDefaultSOAPAction(TypeInfo(IExchangeData), 'urn:ExchangeDataIntf-IExchangeData#%operationName%');<br>&nbsp; InvRegistry.RegisterInvokeOptions(TypeInfo(IExchangeData), ioDocument);//就是这一行<br><br><br>end.
 
另外修改<br>SSoapNameSpace = 'http://schemas.xmlsoap.org/soap/envelope/';<br>这个方法也试过,这个方法不但XP下跑了,2003下还是报同样的错误
 
问题解决了,从网上找到一个24535_delphi_soap_runtime_and_importer_update.ZIP<br>使用了之后就没有问题。它提供从D7到现在所有的soap的改动:)
 
adsfasdf从网上找到一个24535_delphi_soap_runtime_and_importer_update.ZIP<br>使用了之后就没有问题
 
接受答案
 

Similar threads

后退
顶部