project project1.exe raised exception class ESoapDomConvertError with message 'soap response Packet:result element expected,received"<maplistpesponse xmlns="http://tempuri.org/"/>". process stoped.use step or run to continue这个是什么错误?请问错误的原因?如何解决?先谢谢了``
[code=BatchFile]wsdlimp.exe [url][/code]
其中URL是WebService的的发布链接,类似于:http(s)://*/*.asmx?wsdl
然后会生成一个*.pas调用其中的Get*SOAP方法来生成一个WebService对象,就可以调用了。另外,如果是处理如Dot net等生成的microsoft DataSet之类的可能不是那么简单,需要自己写transform.
- <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <soap:Body>
<MaplistResponse xmlns="http://tempuri.org/" />
</soap:Body>
</soap:Envelope>
这个错误提示是正常的,表示取不到Maplist,从而中断调用。只需要通过try ... except拦截并中断后续处理即可。
IS_OPTN = $0001;
IS_UNBD = $0002;
IS_NLBL = $0004;
IS_REF = $0080;
type maplist = class; { "http://tempuri.org/"[GblCplx] } ArrayOfMaplist = array of maplist; { "http://tempuri.org/"[GblCplx] }
// ************************************************************************ //
// XML : maplist, global, <complexType>
// Namespace : http://tempuri.org/
// ************************************************************************ //
maplist = class(TRemotable)
private
Fversion: WideString;
Fversion_Specified: boolean;
Fname_: WideString;
Fname__Specified: boolean;
Fpath: WideString;
Fpath_Specified: boolean;
Fupdatetime: WideString;
Fupdatetime_Specified: boolean;
Fcaption: WideString;
Fcaption_Specified: boolean;
Forderby: WideString;
Forderby_Specified: boolean;
procedure Setversion(Index: Integer; const AWideString: WideString);
function version_Specified(Index: Integer): boolean;
procedure Setname_(Index: Integer; const AWideString: WideString);
function name__Specified(Index: Integer): boolean;
procedure Setpath(Index: Integer; const AWideString: WideString);
function path_Specified(Index: Integer): boolean;
procedure Setupdatetime(Index: Integer; const AWideString: WideString);
function updatetime_Specified(Index: Integer): boolean;
procedure Setcaption(Index: Integer; const AWideString: WideString);
function caption_Specified(Index: Integer): boolean;
procedure Setorderby(Index: Integer; const AWideString: WideString);
function orderby_Specified(Index: Integer): boolean;
published
property version: WideString Index (IS_OPTN) read Fversion write Setversion stored version_Specified;
property name_: WideString Index (IS_OPTN) read Fname_ write Setname_ stored name__Specified;
property path: WideString Index (IS_OPTN) read Fpath write Setpath stored path_Specified;
property updatetime: WideString Index (IS_OPTN) read Fupdatetime write Setupdatetime stored updatetime_Specified;
property caption: WideString Index (IS_OPTN) read Fcaption write Setcaption stored caption_Specified;
property orderby: WideString Index (IS_OPTN) read Forderby write Setorderby stored orderby_Specified;
end; CtransWSSoap = interface(IInvokable)
['{E21F66AB-28C7-AD46-0CF1-FB0F7E7250E7}']
function Maplist(const username: WideString; const password: WideString): ArrayOfMaplist; stdcall;
function GetMap(const username: WideString; const password: WideString; const name_: WideString): TByteDynArray; stdcall;
function AllFileSize(const username: WideString; const password: WideString): Integer; stdcall;
end; TTempleteClass = class
public
class procedure AfterExecuteEvent(const MethodName: string; SOAPResponse: TStream);
end;
function GetCtransWSSoap(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): CtransWSSoap;
implementation
uses SysUtils;
class procedure TTempleteClass.AfterExecuteEvent(const MethodName: string; SOAPResponse: TStream);
begin
TMemoryStream(SOAPResponse).SaveToFile('c:\testxml1.xml');
end;function GetCtransWSSoap(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): CtransWSSoap;
const
defWSDL = 'http://www.insightsoft.cn/insightws/ctransws.asmx?wsdl';
defURL = 'http://www.insightsoft.cn/insightws/ctransws.asmx';
defSvc = 'CtransWS';
defPrt = 'CtransWSSoap';
var
RIO: THTTPRIO;
begin
Result := nil;
if (Addr = '') then
begin
if UseWSDL then
Addr := defWSDL
else
Addr := defURL;
end;
if HTTPRIO = nil then begin
RIO := THTTPRIO.Create(nil);
RIO.OnAfterExecute := TTempleteClass.AfterExecuteEvent;
end
else
RIO := HTTPRIO;
try
Result := (RIO as CtransWSSoap);
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;
procedure maplist.Setversion(Index: Integer; const AWideString: WideString);
begin
Fversion := AWideString;
Fversion_Specified := True;
end;function maplist.version_Specified(Index: Integer): boolean;
begin
Result := Fversion_Specified;
end;procedure maplist.Setname_(Index: Integer; const AWideString: WideString);
begin
Fname_ := AWideString;
Fname__Specified := True;
end;function maplist.name__Specified(Index: Integer): boolean;
begin
Result := Fname__Specified;
end;procedure maplist.Setpath(Index: Integer; const AWideString: WideString);
begin
Fpath := AWideString;
Fpath_Specified := True;
end;function maplist.path_Specified(Index: Integer): boolean;
begin
Result := Fpath_Specified;
end;procedure maplist.Setupdatetime(Index: Integer; const AWideString: WideString);
begin
Fupdatetime := AWideString;
Fupdatetime_Specified := True;
end;function maplist.updatetime_Specified(Index: Integer): boolean;
begin
Result := Fupdatetime_Specified;
end;procedure maplist.Setcaption(Index: Integer; const AWideString: WideString);
begin
Fcaption := AWideString;
Fcaption_Specified := True;
end;function maplist.caption_Specified(Index: Integer): boolean;
begin
Result := Fcaption_Specified;
end;procedure maplist.Setorderby(Index: Integer; const AWideString: WideString);
begin
Forderby := AWideString;
Forderby_Specified := True;
end;function maplist.orderby_Specified(Index: Integer): boolean;
begin
Result := Forderby_Specified;
end;initialization
InvRegistry.RegisterInterface(TypeInfo(CtransWSSoap), 'http://tempuri.org/', 'utf-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(CtransWSSoap), 'http://tempuri.org/%operationName%');
InvRegistry.RegisterInvokeOptions(TypeInfo(CtransWSSoap), ioDocument);
InvRegistry.RegisterExternalParamName(TypeInfo(CtransWSSoap), 'GetMap', 'name_', 'name');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfMaplist), 'http://tempuri.org/', 'ArrayOfMaplist');
RemClassRegistry.RegisterXSClass(maplist, 'http://tempuri.org/', 'maplist');
RemClassRegistry.RegisterExternalPropName(TypeInfo(maplist), 'name_', 'name');end.