问题描述:
.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都很正常的
.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都很正常的
解决方案 »
- OpenPictureDialog怎么不支持jpg的?
- SOS:大家帮忙呀。关于文件读写问题!!!!!
- 关于DBDEMOS的困惑
- 判断文件夹下随时创建的文件,如何得到刚建立的文件的名和路径
- 大家帮忙帮我看看这个控件为什么都加不进去??急!!
- 报表如何不预览直接打印!?
- 谁能帮我做做这两道题目呀,很急呀,关系到我毕业的问题呀。
- 我要画个平面的POPUPMENU
- 新手求救:insert into A(F1....) select FF1.... from B where
- Delphi开发Android的串口控件
- 为什么用CreateOLEObject()后,系统会提示CreateOLEObject()没有定义?
- 图像软件外包,
clint:=flogin.httprio1 as webserice_viod;
兄弟,可以在讲详细点吗?
.net开发的webservice访问地址为:http://218.4.155.114:99/WebService/EntInterface.asmx?WSDL
其中 TouchNetServiceSoap 是你服务的名称
生成单元文件的时候就有了
未将对象引用设置到对象的实例-------这个提示就是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.调用函数