ArrayOffbyte = array of Shortint; 的使用问题 (100分)

  • 主题发起人 主题发起人 fcom
  • 开始时间 开始时间
F

fcom

Unregistered / Unconfirmed
GUEST, unregistred user!
不知道ArrayOffbyte = array of Shortint;这种类型我怎么使用!如何新建和赋值
请哪位高手指点一二!谢谢!
 
ArrayOffbyte 就是你的自定义类型 是一个短整性的动态数组array of Shortint
可以当指针来使用
在不能传递动态数据的过程中经常采用这个方法来使用
不知道说明白没有?
 
能不能举个例子!
我现在是调用用java开发的webservice接口程序如下:
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : http://localhost:8080/HelloWorld/services/HelloWorld?wsdl
// Encoding : UTF-8
// Version : 1.0
// (2004-3-3 22:11:02 - 1.33.2.5)
// ************************************************************************ //

unit HelloWorld1;

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.
// ************************************************************************ //
// !:byte - "http://www.w3.org/2001/XMLSchema"
// !:string - "http://www.w3.org/2001/XMLSchema"

ArrayOffbyte = array of Shortint
{ "null" }

// ************************************************************************ //
// Namespace : http://localhost:8080/HelloWorld/services/HelloWorld
// transport : http://schemas.xmlsoap.org/soap/http
// style : rpc
// binding : HelloWorldSoapBinding
// service : HelloWorldService
// port : HelloWorld
// URL : http://localhost:8080/HelloWorld/services/HelloWorld
// ************************************************************************ //
HelloWorld = interface(IInvokable)
['{CD147AB6-6841-976B-3DA9-2B82C2182674}']
function aa(const temp: ArrayOffbyte): ArrayOffbyte
stdcall;
function sayHelloWorld: WideString
stdcall;
function echo(const u: WideString): WideString
stdcall;
end;

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


implementation

function GetHelloWorld(UseWSDL: Boolean
Addr: string
HTTPRIO: THTTPRIO): HelloWorld;
const
defWSDL = 'http://localhost:8080/HelloWorld/services/HelloWorld?wsdl';
defURL = 'http://localhost:8080/HelloWorld/services/HelloWorld';
defSvc = 'HelloWorldService';
defPrt = 'HelloWorld';
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 HelloWorld);
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(HelloWorld), 'http://localhost:8080/HelloWorld/services/HelloWorld', 'UTF-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(HelloWorld), '');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOffbyte), 'null', 'ArrayOffbyte');

end.

不知道如何把流给传入函数。谢谢!
 
我不熟悉java
ArrayOffbyte = array of Shortint
{ "null" }
function aa(const temp: ArrayOffbyte): ArrayOffbyte
stdcall;
相当于delphi这样的定义,但是实际上这个语法是不对的
function aa(const temp:array of Shortint):array of Shortint;
所以在delphi中要这样使用:
type
ArrayOffbyte = array of Shortint;

function aa(const temp: ArrayOffbyte): ArrayOffbyte;

注意:既然是动态数据就有设置长度。举例:
function aa(const temp: ArrayOffbyte): ArrayOffbyte;
begin
Length(temp);//取temp数组的长度

setLength(aa, N);//设置长度
end;



 
我不知道说明白没有,你可以查一下动态数组的用法
已经很晚了,我要下线了。明天再说吧
 
这是动态数组,你查查帮助就明白了,delphi的帮助说的很详细的,
 
aa :ArrayOffbyte ;

setlength(aa,10);
for i:=0 to 9 do
aa;=i;
 
我是否可以将一个二进制流保存到这个动态数组中去呢?如果可以能否举个例子!谢谢!
 
搞定了谢谢大家!!!
 
后退
顶部