我用java写的web servcies,在java中返回java.uitl.List和java.util.Map,只是作的测试,但在delphi中我不知怎么取到数据。下面代码是java中的代码:
package com.jj.test.axis;import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;public class TestListAndMap { public List getSimpleList() {
List l = new ArrayList();
l.add(new String("List1"));
l.add(new String("List2"));
l.add(new String("List3"));
return l;
} public Map getSimpleMap() {
Map m = new HashMap();
m.put(new Integer(1), new String("Map1"));
m.put(new Integer(2), new String("Map2"));
m.put(new Integer(3), new String("Map3"));
return m;
}
}这个是delphi根据wsdl生成的代码:
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : http://localhost:8080/TestWeb/services/TestListAndMap?wsdl
// Encoding : UTF-8
// Version : 1.0
// (2004-4-23 19:33:54 - 1.33.2.5)
// ************************************************************************ //unit TestListAndMap1;interfaceuses 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.
// ************************************************************************ //
// !:boolean - "http://www.w3.org/2001/XMLSchema" List = class; { "http://util.java" }
Map = class; { "http://util.java" } // ************************************************************************ //
// Namespace : http://util.java
// ************************************************************************ //
List = class(TRemotable)
private
Fempty: Boolean;
published
property empty: Boolean read Fempty write Fempty;
end; // ************************************************************************ //
// Namespace : http://util.java
// ************************************************************************ //
Map = class(TRemotable)
private
Fempty: Boolean;
published
property empty: Boolean read Fempty write Fempty;
end;
// ************************************************************************ //
// Namespace : http://localhost:8080/TestWeb/services/TestListAndMap
// transport : http://schemas.xmlsoap.org/soap/http
// style : rpc
// binding : TestListAndMapSoapBinding
// service : TestListAndMapService
// port : TestListAndMap
// URL : http://localhost:8080/TestWeb/services/TestListAndMap
// ************************************************************************ //
TestListAndMap = interface(IInvokable)
['{05CE82B8-77B5-0B41-E523-08EEF1257259}']
function getSimpleList: List; stdcall;
function getSimpleMap: Map; stdcall;
end;function GetTestListAndMap(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): TestListAndMap;
implementationfunction GetTestListAndMap(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): TestListAndMap;
const
defWSDL = 'http://localhost:8080/TestWeb/services/TestListAndMap?wsdl';
defURL = 'http://localhost:8080/TestWeb/services/TestListAndMap';
defSvc = 'TestListAndMapService';
defPrt = 'TestListAndMap';
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 TestListAndMap);
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(TestListAndMap), 'http://localhost:8080/TestWeb/services/TestListAndMap', 'UTF-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(TestListAndMap), '');
RemClassRegistry.RegisterXSClass(List, 'http://util.java', 'List');
RemClassRegistry.RegisterXSClass(Map, 'http://util.java', 'Map');end.不知怎么取得下面两个方法返回的值:
function getSimpleList: List; stdcall;
function getSimpleMap: Map; stdcall;多谢!!!
package com.jj.test.axis;import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;public class TestListAndMap { public List getSimpleList() {
List l = new ArrayList();
l.add(new String("List1"));
l.add(new String("List2"));
l.add(new String("List3"));
return l;
} public Map getSimpleMap() {
Map m = new HashMap();
m.put(new Integer(1), new String("Map1"));
m.put(new Integer(2), new String("Map2"));
m.put(new Integer(3), new String("Map3"));
return m;
}
}这个是delphi根据wsdl生成的代码:
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : http://localhost:8080/TestWeb/services/TestListAndMap?wsdl
// Encoding : UTF-8
// Version : 1.0
// (2004-4-23 19:33:54 - 1.33.2.5)
// ************************************************************************ //unit TestListAndMap1;interfaceuses 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.
// ************************************************************************ //
// !:boolean - "http://www.w3.org/2001/XMLSchema" List = class; { "http://util.java" }
Map = class; { "http://util.java" } // ************************************************************************ //
// Namespace : http://util.java
// ************************************************************************ //
List = class(TRemotable)
private
Fempty: Boolean;
published
property empty: Boolean read Fempty write Fempty;
end; // ************************************************************************ //
// Namespace : http://util.java
// ************************************************************************ //
Map = class(TRemotable)
private
Fempty: Boolean;
published
property empty: Boolean read Fempty write Fempty;
end;
// ************************************************************************ //
// Namespace : http://localhost:8080/TestWeb/services/TestListAndMap
// transport : http://schemas.xmlsoap.org/soap/http
// style : rpc
// binding : TestListAndMapSoapBinding
// service : TestListAndMapService
// port : TestListAndMap
// URL : http://localhost:8080/TestWeb/services/TestListAndMap
// ************************************************************************ //
TestListAndMap = interface(IInvokable)
['{05CE82B8-77B5-0B41-E523-08EEF1257259}']
function getSimpleList: List; stdcall;
function getSimpleMap: Map; stdcall;
end;function GetTestListAndMap(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): TestListAndMap;
implementationfunction GetTestListAndMap(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): TestListAndMap;
const
defWSDL = 'http://localhost:8080/TestWeb/services/TestListAndMap?wsdl';
defURL = 'http://localhost:8080/TestWeb/services/TestListAndMap';
defSvc = 'TestListAndMapService';
defPrt = 'TestListAndMap';
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 TestListAndMap);
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(TestListAndMap), 'http://localhost:8080/TestWeb/services/TestListAndMap', 'UTF-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(TestListAndMap), '');
RemClassRegistry.RegisterXSClass(List, 'http://util.java', 'List');
RemClassRegistry.RegisterXSClass(Map, 'http://util.java', 'Map');end.不知怎么取得下面两个方法返回的值:
function getSimpleList: List; stdcall;
function getSimpleMap: Map; stdcall;多谢!!!
解决方案 »
- delphi 键盘勾子请教
- 求 3*3 拼图算法,
- 已知进程ID和句柄,如何知道此进程的主窗口句柄~~~~~~~~~~~~~~~~~~~~~~~~~~~100分求助~~~~~~~~~~~~~~~~~~~~~~~~
- 请问Fastreport是如何实现主从关系打印的,急!!!!
- 关于内存搜索的问题
- 怎样才能知道ServerSocket已有多少个连接数?
- 急求局域网内点对点的文件传输代码,,(socket)
- 一条SQL语句的写法
- 高手!!快来呀!!!!!!
- 关于Delphi调用C的接口问题
- 问一个简单的问题,我怎么把Delphi程序中的数据通过SendMessage发送给另一个C#程序,我知道是用消息传递,但我不会Delphi,请大侠帮忙
- 怎样可以看出一个组件的继承关系
因为ArrayList存储的是Object对象,无法进行正常xml序列化