如果wsdl产生的Server// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : http://192.168.1.51:8080/zis/services/zisService?wsdl
// Encoding : UTF-8
// Version : 1.0
// (2010-7-21 11:51:35 - $Revision: 1.9.1.0.1.0.1.9 $)
// ************************************************************************ //unit zisService;interfaceuses InvokeRegistry, 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.
// ************************************************************************ //
// !:string - "http://www.w3.org/2001/XMLSchema"
// !:base64Binary - "http://www.w3.org/2001/XMLSchema"
// ************************************************************************ //
// Namespace : http://services.zis.ttts.com/
// transport : http://schemas.xmlsoap.org/soap/http
// style : document
// binding : ZisImplServiceSoapBinding
// service : ZisImplService
// port : ZisImplPort
// URL : http://192.168.1.51:8080/zis/services/zisService
// ************************************************************************ //
IZis = interface(IInvokable)
['{BDFC17AF-6281-0927-A60D-8ED6802ED455}']
function getDataStandard(const softwareName: String): TByteDynArray; stdcall;
procedure saveDataForJson(const softwareName: String; const jsonData: String); stdcall;
end;function GetIZis(UseWSDL: Boolean=System.False; Addr: string=''): IZis;
implementation
uses SOAPHTTPClient;function GetIZis(UseWSDL: Boolean; Addr: string): IZis;
const
defWSDL = 'http://192.168.1.51:8080/zis/services/zisService?wsdl';
defURL = 'http://192.168.1.51:8080/zis/services/zisService';
defSvc = 'ZisImplService';
defPrt = 'ZisImplPort';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
RIO := THTTPRIO.Create(nil);
try
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end else
RIO.URL := Addr;
Result := (RIO as IZis);
finally
if Result = nil then
RIO.Free;
end;
end;
initialization
InvRegistry.RegisterInterface(TypeInfo(IZis), 'http://services.zis.ttts.com/', 'UTF-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(IZis), '');
InvRegistry.RegisterInvokeOptions(TypeInfo(IZis), ioDocument);end.调用程序unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Types;type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementationuses zisService;{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
a,b : string;
ws : IZis;
begin
a := 'test';
b := '[{"studentName":"张三","studentSex":"男","age":25,"birthday":"2010-07-07","cost":12.5,"regDate":"2010-07-07 04:54:01"}]';
// ShowMessage('1');
ws := GetIZis(False,'');
// ShowMessage('2');
ws.saveDataForJson(a,b);
// ShowMessage('bb');
// GetIZis.('bb','bb');
//
end;
end.
说明
1.webserver是java开发的
2.用C#开发的调用程序正常问题:
1.我用Delphi 写的调用webserver时,在服务器那里查看时发现传过去的值为空,可是我在Delphi明明传了值啊
2.单独运行delphi产生后的exe时,点击button1时出错,错误信息为Access violation at address 00BF5210. Write of address 00BF5210. 但我用delphi 调试时都不会出错.不知道什么原因..各位朋友,帮帮忙,,
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : http://192.168.1.51:8080/zis/services/zisService?wsdl
// Encoding : UTF-8
// Version : 1.0
// (2010-7-21 11:51:35 - $Revision: 1.9.1.0.1.0.1.9 $)
// ************************************************************************ //unit zisService;interfaceuses InvokeRegistry, 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.
// ************************************************************************ //
// !:string - "http://www.w3.org/2001/XMLSchema"
// !:base64Binary - "http://www.w3.org/2001/XMLSchema"
// ************************************************************************ //
// Namespace : http://services.zis.ttts.com/
// transport : http://schemas.xmlsoap.org/soap/http
// style : document
// binding : ZisImplServiceSoapBinding
// service : ZisImplService
// port : ZisImplPort
// URL : http://192.168.1.51:8080/zis/services/zisService
// ************************************************************************ //
IZis = interface(IInvokable)
['{BDFC17AF-6281-0927-A60D-8ED6802ED455}']
function getDataStandard(const softwareName: String): TByteDynArray; stdcall;
procedure saveDataForJson(const softwareName: String; const jsonData: String); stdcall;
end;function GetIZis(UseWSDL: Boolean=System.False; Addr: string=''): IZis;
implementation
uses SOAPHTTPClient;function GetIZis(UseWSDL: Boolean; Addr: string): IZis;
const
defWSDL = 'http://192.168.1.51:8080/zis/services/zisService?wsdl';
defURL = 'http://192.168.1.51:8080/zis/services/zisService';
defSvc = 'ZisImplService';
defPrt = 'ZisImplPort';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
RIO := THTTPRIO.Create(nil);
try
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
end else
RIO.URL := Addr;
Result := (RIO as IZis);
finally
if Result = nil then
RIO.Free;
end;
end;
initialization
InvRegistry.RegisterInterface(TypeInfo(IZis), 'http://services.zis.ttts.com/', 'UTF-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(IZis), '');
InvRegistry.RegisterInvokeOptions(TypeInfo(IZis), ioDocument);end.调用程序unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Types;type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementationuses zisService;{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
a,b : string;
ws : IZis;
begin
a := 'test';
b := '[{"studentName":"张三","studentSex":"男","age":25,"birthday":"2010-07-07","cost":12.5,"regDate":"2010-07-07 04:54:01"}]';
// ShowMessage('1');
ws := GetIZis(False,'');
// ShowMessage('2');
ws.saveDataForJson(a,b);
// ShowMessage('bb');
// GetIZis.('bb','bb');
//
end;
end.
说明
1.webserver是java开发的
2.用C#开发的调用程序正常问题:
1.我用Delphi 写的调用webserver时,在服务器那里查看时发现传过去的值为空,可是我在Delphi明明传了值啊
2.单独运行delphi产生后的exe时,点击button1时出错,错误信息为Access violation at address 00BF5210. Write of address 00BF5210. 但我用delphi 调试时都不会出错.不知道什么原因..各位朋友,帮帮忙,,
2.单独运行delphi产生后的exe时,点击button1时出错,错误信息为Access violation at address 00BF5210. Write of address 00BF5210. 但我用delphi 调试时都不会出错.不知道什么原因..各位朋友,帮帮忙,,第一个问题解决..问题一个第二个问题...