用Java开发的服务器我用Delphi调用,调用函数时老是报错:
cannot find dispatch method for{null}terminalNo using "payload Qname-based dispatcher"
、、
HTTPRIO1.WSDLLocation := 'http://130.251.9.98:8088/pms/propertyManagementFeeService?wsdl'; HTTPRIO1.Service := 'PropertyManagementFee';
HTTPRIO1.Port := 'PropertyManagementFeeImplPort';
HTTPRIO1.HTTPWebNode.UseUTF8InHeader:=True;procedure TForm1.Button1Click(Sender: TObject);
var
myWp: PropertyManagementFeeImpl;
myWS: WideString;
str0,str1,str2,str3,str4,str5,str6:WideString; I: Integer;
begin
Memo1.Clear;
myWp := HTTPRIO1 as PropertyManagementFeeImpl;
str0:='1234';
str1:='112';
str2:='212';
str3:='31';
str4:='20100801';
str5:='20100805';
str6:=‘3333’
myWS := mywp.queryFee(str0,str1,str2,str3,str4,str5,str6);
{for I := Low(myWS) to High(myWS) do
begin
Memo1.Lines.Add(myWS[I]);
end; }
Memo1.Lines.Add(myWS);end;
请问是什么问题??
cannot find dispatch method for{null}terminalNo using "payload Qname-based dispatcher"
、、
HTTPRIO1.WSDLLocation := 'http://130.251.9.98:8088/pms/propertyManagementFeeService?wsdl'; HTTPRIO1.Service := 'PropertyManagementFee';
HTTPRIO1.Port := 'PropertyManagementFeeImplPort';
HTTPRIO1.HTTPWebNode.UseUTF8InHeader:=True;procedure TForm1.Button1Click(Sender: TObject);
var
myWp: PropertyManagementFeeImpl;
myWS: WideString;
str0,str1,str2,str3,str4,str5,str6:WideString; I: Integer;
begin
Memo1.Clear;
myWp := HTTPRIO1 as PropertyManagementFeeImpl;
str0:='1234';
str1:='112';
str2:='212';
str3:='31';
str4:='20100801';
str5:='20100805';
str6:=‘3333’
myWS := mywp.queryFee(str0,str1,str2,str3,str4,str5,str6);
{for I := Low(myWS) to High(myWS) do
begin
Memo1.Lines.Add(myWS[I]);
end; }
Memo1.Lines.Add(myWS);end;
请问是什么问题??
解决方案 »
- delphi怎么批量去除MP3广告
- 帮忙!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- 请问各位高手自定义消息的ID号 是怎样与消息的数据结构关联在一起的呢
- 偶是菜鸟问个很弱智的问题。
- 大家来帮忙分析一下代码:关于窗体类继承中Create;overload部分引起 子窗体不能创建!!! 高分!!
- fastreport的横向怎么出不来。是怎么回事!
- 如何在opengl的场景里面写文本。
- 杭州工作难找!!!!
- 请教:哪位知道广州哪个地方有道版的计算机书批发,可以打到多少折?
- 如何在自画TreeView时自由设定Node的Text位置
- 让某程序标题不显示在任务栏
- erp的时间连接问题
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : http://172.20.100.10/test/service.asmx?wsdl
// >Import : http://172.20.100.10/test/service.asmx?wsdl:0
// Encoding : utf-8
// Version : 1.0
// (2010/6/22 上午 11:31:35 - - $Rev: 10138 $)
// ************************************************************************ //unit service;interfaceuses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;const
IS_OPTN = $0001;
IS_REF = $0080;
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"[Gbl] // ************************************************************************ //
// Namespace : Kye
// soapAction: Kye/HelloWorld
// transport : http://schemas.xmlsoap.org/soap/http
// style : document
// binding : ServiceSoap
// service : Service
// port : ServiceSoap
// URL : http://172.20.100.10/test/service.asmx
// ************************************************************************ //
ServiceSoap = interface(IInvokable)
['{B82FAFBA-EAB8-AD5C-2535-FB6046355616}']
function HelloWorld(const name_: WideString): WideString; stdcall;
end;function GetServiceSoap(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): ServiceSoap;
implementation
uses SysUtils;function GetServiceSoap(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): ServiceSoap;
const
defWSDL = 'http://172.20.100.10/test/service.asmx?wsdl';
defURL = 'http://172.20.100.10/test/service.asmx';
defSvc = 'Service';
defPrt = 'ServiceSoap';
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 ServiceSoap);
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(ServiceSoap), 'Kye', 'utf-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(ServiceSoap), 'Kye/HelloWorld');
InvRegistry.RegisterInvokeOptions(TypeInfo(ServiceSoap), ioDocument);
InvRegistry.RegisterExternalParamName(TypeInfo(ServiceSoap), 'HelloWorld', 'name_', 'name');end.
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,service, StdCtrls;type
TForm1 = class(TForm)
btn1: TButton;
edt1: TEdit;
Label1: TLabel;
procedure btn1Click(Sender: TObject);
private
aa:ServiceSoap;
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.btn1Click(Sender: TObject);
begin
aa:=GetServiceSoap(False,'',nil);
ShowMessage(aa.HelloWorld(edt1.Text));
end;end.
// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : http://localhost:8081/pms/propertyManagementFeeService?wsdl
// Encoding : UTF-8
// Version : 1.0
// (2010-8-7 12:19:03 - 1.33.2.5)
// ************************************************************************ //unit ManagementFee;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.
// ************************************************************************ //
// !:string - "http://www.w3.org/2001/XMLSchema"
// ************************************************************************ //
// Namespace : http://webService.controller.pms.com/service
// soapAction: queryFee
// transport : http://schemas.xmlsoap.org/soap/http
// style : rpc
// binding : TestWebservicePortBinding
// service : PropertyManagementFee
// port : TestWebservicePort
// URL : http://localhost:8081/pms/propertyManagementFeeService
// ************************************************************************ //
TestWebservice = interface(IInvokable)
['{0120CFE6-ABE2-48BE-484F-360D45DEFC99}']
function queryFee(const terminalNo: WideString; const propertyCode: WideString; const number: WideString; const room: WideString; const startDate: WideString; const endDate: WideString; const mac: WideString): WideString; stdcall;
end;function GetTestWebservice(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): TestWebservice;
implementationfunction GetTestWebservice(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): TestWebservice;
const
defWSDL = 'http://localhost:8081/pms/propertyManagementFeeService?wsdl';
defURL = 'http://localhost:8081/pms/propertyManagementFeeService';
defSvc = 'PropertyManagementFee';
defPrt = 'TestWebservicePort';
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 TestWebservice);
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(TestWebservice), 'http://webService.controller.pms.com/service', 'UTF-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(TestWebservice), 'queryFee');
InvRegistry.RegisterInvokeOptions(TypeInfo(TestWebservice), ioLiteral);end.
InvRegistry.RegisterInvokeOptions(TypeInfo(TestWebservice), ioDocument); ------就是把 ioLiteral 改成 ioDocument, 就能收到数据了 哈哈
不过还有个问题,发送后,服务端收到的数据是:
接收参数:terminalNo=null
propertyCode=null
number=null
room=null
startDate=null
endDate=null
mac=null返回参数:0000|测试返回结果
可以我已经给他参数了,这个是什么原因?
是因为没有类似 InvRegistry.RegisterExternalParamName(TypeInfo(ServiceSoap), 'HelloWorld', 'name_', 'name');这样的语句吗?
刚开始时
InvRegistry.RegisterInvokeOptions(TypeInfo(TestWebservice), ioLiteral ); ------报错“cannot find dispatch method for{null}terminalNo using "payload Qname-based dispatcher" ”
然后修改
InvRegistry.RegisterInvokeOptions(TypeInfo(TestWebservice), ioDocument); ------就是把 ioLiteral 改成 ioDocument,
现在不报错,可是 服务端收到的参数是null , 这是什么原因呢? 等待高手...
-------Delphi客户端调用服务端的java webservice
或者改成不是ioDocument和ioLiteral 都可以,具体为什么,我现在不知道,还请高手解答一下哈
来源: http://www.programbbs.com/bbs/view12-28527-1.htm