你好,我已经加了你的qq,也写了些东西,我对webservice也没有深入的了解过,所以我们也是讨论,对于你生成的这个wsdl文件,我觉得可能其中的某些东西delphi识别不了,我试着把你这个wsdl文件中的port的name name="urn:pes"改为name="person" 然后用delphi导入得到这样一个pas文件 你可以很清楚地看出差别,那就是多了入口函数 function Getrecord_(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): record_;很显然只有先调用这个函数,得到record_的类型,才可以使用其中的方法getrecord// ************************************************************************ // // The types declared in this file were generated from data read from the // WSDL File described below: // WSDL : C:\Documents and Settings\Administrator\ラタテ觸123.wsdl // Encoding : UTF-8 // Version : 1.0 // (2004-9-23 20:35:35 - 1.33.2.5) // ************************************************************************ //unit _23;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" person = class; { "http://mypack" } // ************************************************************************ // // Namespace : http://mypack // ************************************************************************ // person = class(TRemotable) private Faddr: WideString; Fname: WideString; published property addr: WideString read Faddr write Faddr; property name: WideString read Fname write Fname; end; // ************************************************************************ // // Name : record // Namespace : http://localhost/axis/services/person // transport : http://schemas.xmlsoap.org/soap/http // style : rpc // binding : personSoapBinding // service : recordService // port : person // URL : http://localhost/axis/services/person // ************************************************************************ // record_ = interface(IInvokable) ['{FCA16436-642C-2DEB-AB81-B5337753FEA2}'] function getrecord: person; stdcall; end;function Getrecord_(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): record_; implementationfunction Getrecord_(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): record_; const defWSDL = 'C:\Documents and Settings\Administrator\ラタテ觸123.wsdl'; defURL = 'http://localhost/axis/services/person'; defSvc = 'recordService'; defPrt = 'person'; 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 record_); 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(record_), 'http://localhost/axis/services/person', 'UTF-8', '', 'record'); InvRegistry.RegisterDefaultSOAPAction(TypeInfo(record_), ''); RemClassRegistry.RegisterXSClass(person, 'http://mypack', 'person');end.
我只是觉得你的pes.pas文件中没有webservice的入口函数,
没有入口函数你怎么调用,这是不可能的。
function getrecord: person; stdcall;这不是入口函数吗?所有文件就这么多,全贴了..我也想不明白呀...
应该还有一个返回record_类型的入口函数,你发布了webservice肯定会有wsdl文件吧,你把那个文件发上来。
<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions targetNamespace="http://localhost/axis/services/urn:pes" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost/axis/services/urn:pes" xmlns:intf="http://localhost/axis/services/urn:pes" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="http://mypack" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <wsdl:types>
- <schema targetNamespace="http://mypack" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
- <complexType name="person">
- <sequence>
<element name="addr" nillable="true" type="xsd:string" />
<element name="name" nillable="true" type="xsd:string" />
</sequence>
</complexType>
</schema>
</wsdl:types>
- <wsdl:message name="getrecordResponse">
<wsdl:part name="getrecordReturn" type="tns1:person" />
</wsdl:message>
<wsdl:message name="getrecordRequest" />
- <wsdl:portType name="record">
- <wsdl:operation name="getrecord">
<wsdl:input message="impl:getrecordRequest" name="getrecordRequest" />
<wsdl:output message="impl:getrecordResponse" name="getrecordResponse" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="urn:pesSoapBinding" type="impl:record">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="getrecord">
<wsdlsoap:operation soapAction="" />
- <wsdl:input name="getrecordRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost/axis/services/urn:pes" use="encoded" />
</wsdl:input>
- <wsdl:output name="getrecordResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost/axis/services/urn:pes" use="encoded" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="recordService">
- <wsdl:port binding="impl:urn:pesSoapBinding" name="urn:pes">
<wsdlsoap:address location="http://localhost/axis/services/urn:pes" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
你可以很清楚地看出差别,那就是多了入口函数
function Getrecord_(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): record_;很显然只有先调用这个函数,得到record_的类型,才可以使用其中的方法getrecord// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : C:\Documents and Settings\Administrator\ラタテ觸123.wsdl
// Encoding : UTF-8
// Version : 1.0
// (2004-9-23 20:35:35 - 1.33.2.5)
// ************************************************************************ //unit _23;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" person = class; { "http://mypack" } // ************************************************************************ //
// Namespace : http://mypack
// ************************************************************************ //
person = class(TRemotable)
private
Faddr: WideString;
Fname: WideString;
published
property addr: WideString read Faddr write Faddr;
property name: WideString read Fname write Fname;
end;
// ************************************************************************ //
// Name : record
// Namespace : http://localhost/axis/services/person
// transport : http://schemas.xmlsoap.org/soap/http
// style : rpc
// binding : personSoapBinding
// service : recordService
// port : person
// URL : http://localhost/axis/services/person
// ************************************************************************ //
record_ = interface(IInvokable)
['{FCA16436-642C-2DEB-AB81-B5337753FEA2}']
function getrecord: person; stdcall;
end;function Getrecord_(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): record_;
implementationfunction Getrecord_(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): record_;
const
defWSDL = 'C:\Documents and Settings\Administrator\ラタテ觸123.wsdl';
defURL = 'http://localhost/axis/services/person';
defSvc = 'recordService';
defPrt = 'person';
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 record_);
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(record_), 'http://localhost/axis/services/person', 'UTF-8', '', 'record');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(record_), '');
RemClassRegistry.RegisterXSClass(person, 'http://mypack', 'person');end.
散分.......