调webservice

虎滴小猪猪 2013-08-01 04:21:01
http://www.nnzbzh.cn:6000/ZBXZXService?wsdl
这是地址,

// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : http://www.nnzbzh.cn:6000/ZBXZXService?wsdl
// Encoding : utf-8
// Version : 1.0
// (2013-8-1 10:24:52 - 1.33.2.5)
// ************************************************************************ //

unit uZBXZXService;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

type

// ************************************************************************ //
// The following types, referred to in the WSDL document are not being represented
// in this file. They are either aliases[@] of other types represented or were referred
// to but never[!] declared in the document. The types from the latter category
// typically map to predefined/known XML or Borland types; however, they could also
// indicate incorrect WSDL documents that failed to declare or import a schema type.
// ************************************************************************ //
// !:GetMes - "http://tempuri.org/"
// !:GetMesResponse - "http://tempuri.org/"
// !:GetMesLeng - "http://tempuri.org/"
// !:GetMesLengResponse - "http://tempuri.org/"
// !:inqTranFlow - "http://tempuri.org/"
// !:inqTranFlowResponse - "http://tempuri.org/"
// !:GetHBMD - "http://tempuri.org/"
// !:GetHBMDResponse - "http://tempuri.org/"
// !:GetAllMes - "http://tempuri.org/"
// !:GetAllMesResponse - "http://tempuri.org/"
// !:GetXZXMES - "http://tempuri.org/"
// !:GetXZXMESResponse - "http://tempuri.org/"
// !:GetHBMDSNUM - "http://tempuri.org/"
// !:GetHBMDSNUMResponse - "http://tempuri.org/"
//以下是我自己加的+++
GetHBMD = Class;
GetHBMDResponse = Class;
GetHBMDSNUM = Class;
GetHBMDSNUMResponse = Class;

GetHBMD = class(TSOAPHeader)
private
Fid: WideString;
Fcount: WideString;
FYZM: WideString;
public
published
property id: WideString read Fid write Fid;
property count: WideString read Fcount write Fcount;
property YZM: WideString read FYZM write FYZM;
end;

GetHBMDResponse = class(TSOAPHeader)
private
Freturn: WideString;
public
published
property return: WideString read Freturn write Freturn;
end;

GetHBMDSNUM = class(TSOAPHeader)
private
public
published
end;

GetHBMDSNUMResponse = class(TSOAPHeader)
private
Freturn: WideString;
public
published
property return: WideString read Freturn write Freturn;
end;
//以上是我自己加的———
// ************************************************************************ //
// Namespace : http://tempuri.org/
// soapAction: http://tempuri.org/IService/%operationName%
// transport : http://schemas.xmlsoap.org/soap/http
// binding : BasicHttpBinding_IService
// service : Service
// port : BasicHttpBinding_IService
// URL : http://www.nnzbzh.cn:6000/ZBXZXService
// ************************************************************************ //
IService = interface(IInvokable)
['{98ED6C0B-93D7-7F02-40EA-9A0E061E5A66}']
//function GetMes(const parameters: GetMes): GetMesResponse; stdcall;
//function GetMesLeng(const parameters: GetMesLeng): GetMesLengResponse; stdcall;
//function inqTranFlow(const parameters: inqTranFlow): inqTranFlowResponse; stdcall;
function GetHBMD(const parameters: GetHBMD): GetHBMDResponse; stdcall;
//function GetAllMes(const parameters: GetAllMes): GetAllMesResponse; stdcall;
//function GetXZXMES(const parameters: GetXZXMES): GetXZXMESResponse; stdcall;
function GetHBMDSNUM(const parameters: GetHBMDSNUM): GetHBMDSNUMResponse; stdcall;
end;

function GetIService(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): IService;


implementation

function GetIService(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): IService;
const
defWSDL = 'http://www.nnzbzh.cn:6000/ZBXZXService?wsdl';
defURL = 'http://www.nnzbzh.cn:6000/ZBXZXService';
defSvc = 'Service';
defPrt = 'BasicHttpBinding_IService';
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 IService);
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
InvRegistry.RegisterInterface(TypeInfo(IService), 'http://tempuri.org/', 'utf-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(IService), 'http://tempuri.org/IService/%operationName%');
InvRegistry.RegisterInvokeOptions(TypeInfo(IService), ioLiteral);
end.


我想调用GetHBMD和GetHBMDSUN函数,并且能在程序里改wsdl的地址,谁帮我写一个调用的代码,谢谢。
...全文
396 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
虎滴小猪猪 2013-08-27
  • 打赏
  • 举报
回复
我在delphi 里直接加http://www.nnzbzh.cn:6000/ZBXZXService?wsdl.
编译报错。

虎滴小猪猪 2013-08-27
  • 打赏
  • 举报
回复
错了,是怎么Create?
虎滴小猪猪 2013-08-27
  • 打赏
  • 举报
回复
怎么Greate?
林石公 2013-08-26
  • 打赏
  • 举报
回复
是不是你的sGhbmdSun根本没create??
虎滴小猪猪 2013-08-26
  • 打赏
  • 举报
回复

    

sGhbmdSun: GetHBMDSNUM;
sRstValue: GetHBMDSNUMResponse;

HTTPRIO1.WSDLLocation := 'http://www.nnzbzh.cn:6000/ZBXZXService?wsdl';
sRstValue := (HTTPRIO1 as IService).GetHBMDSNUM(sGhbmdSun); //这句报错
董董 2013-08-23
  • 打赏
  • 举报
回复
引用 4 楼 ljfwyh 的回复:
我按照三楼的调用,然后报错。
贴你的源代码和报错截图。
虎滴小猪猪 2013-08-22
  • 打赏
  • 举报
回复
我按照三楼的调用,然后报错。
董董 2013-08-20
  • 打赏
  • 举报
回复
procedure yourProcedure; var yourGetHBMDResponse: GetHBMDResponse; YourNewWDSLAddr: string; begin YourNewWDSLAddr := 'http://xxx?wsdl'; yourGetHBMDResponse := GetIService(True, YourNewWDSLAddr).GetHBMD(YourParameters); end;
XD王 2013-08-20
  • 打赏
  • 举报
回复
帮你顶一个
虎滴小猪猪 2013-08-06
  • 打赏
  • 举报
回复
为啥没人帮我啊?顶一个。

16,748

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧