用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;
请问是什么问题??

解决方案 »

  1.   

    不能找到调度方法利用“terminalNo } {零载荷Qname-based)......你把XML的數據抓出來show一下看看呢...
      

  2.   

    寫了一個測試的demo給你參考:
     // ************************************************************************ //
    // 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.
      

  3.   

    調用:
    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.
     
      

  4.   

    一下代码是 D7 自动生成的,高手看一下,有没有问题?
    // ************************************************************************ //
    // 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.
      

  5.   

    刚才改了一下:在注册的最后一句:
    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');这样的语句吗?
      

  6.   

    问题总结:::
    刚开始时
    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   
      

  7.   

    刚才调用成功了,我只是把InvRegistry.RegisterInvokeOptions(TypeInfo(TestWebservice), ioDocument);  注释掉
    或者改成不是ioDocument和ioLiteral   都可以,具体为什么,我现在不知道,还请高手解答一下哈
    来源: http://www.programbbs.com/bbs/view12-28527-1.htm
      

  8.   

    传递参数给WEB SERVICE,服务器端接受到的参数总是为空,原因是用document的方式去调用RPC方式的WEB SERVICE。