问题描述:
.net开发的webservice访问地址为:http://218.4.155.114:99/WebService/EntInterface.asmx?WSDL用delphi7编写客户端程序,访问此webservice出现奇怪错误。
先file-new-other-webservice 选择wsdl importer 输入“http://218.4.155.114:99/WebService/EntInterface.asmx?WSDL”
生成单元文件EntInterface。有三个函数可以调用
function  SendMessage(const strLoginCode: WideString; const strPass: WideString; const strSpNum: WideString; const strRecvNum: WideString; const strMsg: WideString; const bConfirm: Integer; const AtDate: WideString): WideString; stdcall;
    function  RecvMessage(const strLoginCode: WideString; const strPass: WideString): WideString; stdcall;
    function  GetStatus(const strLoginCode: WideString; const strPass: WideString; const strSendID: WideString): WideString; stdcall;
  然后使用THTTPRIO调用webservice的函数
procedure TForm1.Button1Click(Sender: TObject);
var
 s:string;
begin
    HTTPRIO1.HTTPWebNode.UseUTF8InHeader := true;
    HTTPRIO1.URL := 'http://218.4.155.114:99/WebService/EntInterface.asmx';
    s :=  (HTTPRIO1 as EntInterfaceSoap).SendMessage('aa','bb','55','0123456','aaa',0,'');
    Button1.Caption := s;
end;
     
1.调用SendMessage函数时出现下列异常
发送消息出现错误  System.Web.Services.Protocols.SoapException: 服务器无法处理请求。 ---> System.NullReferenceException: 未将对象引用设置到对象的实例。
   at qxtweb.WebService.EntInterface.SendMessage(String strLoginCode, String strPass, String strSpNum, String strRecvNum, String strMsg, Int32 bConfirm, String AtDate)
   --- 内部异常堆栈跟踪的结尾 --2.调用GetStatus函数出现下列异常
发送消息出现错误  System.Web.Services.Protocols.SoapException: 服务器无法处理请求。 ---> System.ArgumentNullException: String 引用没有设置为 String 的实例。
参数名: s
   at System.Text.UTF8Encoding.GetBytes(String s)
   at TZCT.DB.SetRSAPass.Encrypting(String Source, String Key)
   at qxtweb.WebService.EntInterface.RecvMessage(String strLoginCode, String strPass)
   --- 内部异常堆栈跟踪的结尾 --3.调用RecvMessage函数出现下列异常
发送消息出现错误  System.Web.Services.Protocols.SoapException: 服务器无法处理请求。 ---> System.ArgumentNullException: 值不能为空。
参数名: input
   at System.Text.RegularExpressions.Regex.IsMatch(String input)
   at System.Text.RegularExpressions.Regex.IsMatch(String input, String pattern)
   at TZCT.DB.BaseFunction.IsUnsign(String str)
   at qxtweb.WebService.EntInterface.GetStatus(String strLoginCode, String strPass, String strSendID)
   --- 内部异常堆栈跟踪的结尾 ---
请高手帮忙看看怎么解决这个问题啊?
以前用delphi7调用webservice都很正常的

解决方案 »

  1.   

    var clint:webserice_viod;
    clint:=flogin.httprio1 as webserice_viod;
      

  2.   

    呵呵,webserice_viod是?
    兄弟,可以在讲详细点吗?
      

  3.   

    这个问题很奇怪,会不会是webservice本身的问题?
      

  4.   

    大家可以自己试一下的
    .net开发的webservice访问地址为:http://218.4.155.114:99/WebService/EntInterface.asmx?WSDL 
      

  5.   

    加上这句试试。InvRegistry.RegisterInvokeOptions(TypeInfo(TouchNetServiceSoap), ioDocument);
    其中 TouchNetServiceSoap 是你服务的名称
      

  6.   

    InvRegistry.RegisterInvokeOptions(TypeInfo(TouchNetServiceSoap),   ioDocument); 
    生成单元文件的时候就有了
      

  7.   

    你这个问题我也遇到过
    未将对象引用设置到对象的实例-------这个提示就是webservice中不存在这个函数或是你的函数名称和他的不对应。
    如果你是用file-new-other-webservice新建webservice是应该不会有错了。那就可能是webservice的错误了。
    我是这样用的
    type
      TWebServiceInterface = class (TObject)
      private
        RIO: THttpRIO;
        EntSOAP: EntInterfaceSoap;
      public
        constructor Create;overload;
      end;
    var
      objWSI: TWebServiceInterface ;implementation
    constructor TWebServiceInterface.Create;
    begin
      RIO := THttpRIO.Create(Application);
      EntSOAP:= GetClientAppServiceSoap(True,'',RIO);
    end;
    EntSOAP.调用函数 
      

  8.   

    估计delphi7的控件和webservice的版本对不上