SOAP在D6中没有调试通过!(附源码!)(50分)

  • 主题发起人 主题发起人 hunyuan
  • 开始时间 开始时间
H

hunyuan

Unregistered / Unconfirmed
GUEST, unregistred user!
http://mental.top263.net/mentals/progart/tech/d6_soap1.htm
按照以上网址的例子,服务器端源码如下:
unit MainWM;
interface
uses
SysUtils, Classes, HTTPApp, WSDLPub, SOAPPasInv, SOAPHTTPPasInv,
SoapHTTPDisp, WebBrokerSOAP;
type
TWebModule1 = class(TWebModule)
HTTPSoapDispatcher1: THTTPSoapDispatcher;
HTTPSoapPascalInvoker1: THTTPSoapPascalInvoker;
WSDLHTMLPublish1: TWSDLHTMLPublish;
private
{ Private declarations }
public
{ Public declarations }
end;
ISoapHello = Interface (IInvokable)
['{25C75B89-B4B5-11D5-AFBA-0000F01B4577}'] // 这个GUID你自己用 Ctrl+Shift+G 产生
Function GetHello( aID : Integer ) : WideString;
StdCall;
end;

TSoapHello = Class(TInvokableClass,ISoapHello)
Protected
Function GetHello( aID : Integer ) : WideString;
StdCall;
end;

var
WebModule1: TWebModule1;
implementation

{$R *.DFM}
uses
InvokeRegistry;
Initialization
InvRegistry.RegisterInterface(TypeInfo(ISoapHello));
InvRegistry.RegisterInvokableClass(TSoapHello);
Function TSoapHello.GetHello(aID:Integer):WideString;
begin
If (aID=1) then
Result:='Hello world!'
else
Result:= Error ID!';
end;

end.

无法调试通过,请指出语法错误!
 
编译出错:
[Error] MAINWM.pas(24): Undeclared identifier: 'TInvokableClass'
 
我的源程序中哪个地方不对呢?
 
unit unit1;
interface
uses
SysUtils, Classes, HTTPApp, WSDLPub, SOAPPasInv, SOAPHTTPPasInv,
SoapHTTPDisp, WebBrokerSOAP,[blue]InvokeRegistry[/blue];

type
TWebModule1 = class(TWebModule)
HTTPSoapDispatcher1: THTTPSoapDispatcher;
HTTPSoapPascalInvoker1: THTTPSoapPascalInvoker;
WSDLHTMLPublish1: TWSDLHTMLPublish;
private
{ Private declarations }
public
{ Public declarations }
end;
ISoapHello = Interface (IInvokable)
['{25C75B89-B4B5-11D5-AFBA-0000F01B4577}'] // 这个GUID你自己用 Ctrl+Shift+G 产生
Function GetHello( aID : Integer ) : WideString;
StdCall;
end;

TSoapHello = Class(TInvokableClass,ISoapHello)
Protected
Function GetHello( aID : Integer ) : WideString;
StdCall;
end;

var
WebModule1: TWebModule1;
implementation

{$R *.DFM}


Function TSoapHello.GetHello(aID:Integer):WideString;
begin
If (aID=1) then
Result:='Hello world!'
else
Result:= 'Error ID!';
end;

[blue]Initialization
InvRegistry.RegisterInterface(TypeInfo(ISoapHello));
InvRegistry.RegisterInvokableClass(TSoapHello);[/blue]
end.
 
这个例子我也有问题:
我的浏览器返回的xml如下,为什么它的根结点不是[red]envelope[/red]而是[red]definitions[/red]?
我的问题在:http://www.delphibbs.com/delphibbs/dispq.asp?lid=725277
代码:
  <?xml version="1.0" ?> 
- <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema" name="ISoapHelloservice" targetNamespace="http://www.borland.com/soapServices/" xmlns:tns="http://www.borland.com/soapServices/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
- <message name="GetHelloRequest">
  <part name="aID" type="xs:int" /> 
  </message>
- <message name="GetHelloResponse">
  <part name="return" type="xs:string" /> 
  </message>
- <portType name="ISoapHello">
- <operation name="GetHello">
  <input message="tns:GetHelloRequest" /> 
  <output message="tns:GetHelloResponse" /> 
  </operation>
  </portType>
- <binding name="ISoapHellobinding" type="tns:ISoapHello">
  <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> 
- <operation name="GetHello">
  <soap:operation soapAction="urn:MainWM-ISoapHello#GetHello" /> 
- <input>
  <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:MainWM-ISoapHello" /> 
  </input>
- <output>
  <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:MainWM-ISoapHello" /> 
  </output>
  </operation>
  </binding>
- <service name="ISoapHelloservice">
- <port name="ISoapHelloPort" binding="tns:ISoapHellobinding">
  <soap:address location="http://222.222.222.99/soap/soaptest.dll/soap/ISoapHello" /> 
  </port>
  </service>
  </definitions>
 
接受答案了.
 
后退
顶部