nm_wyh说的这句有的,除了ioDocument参数改成其他参数都会报EJB Exception错误,引用webservice代码如下,大家看看,这是哪的问题,快崩溃了。// ************************************************************************ // // The types declared in this file were generated from data read from the // WSDL File described below: // WSDL : http://58.216.220.27:8004/SlowUploadService/SlowUploadService?WSDL // >Import : http://58.216.220.27:8004/SlowUploadService/SlowUploadService?WSDL:0 // >Import : http://58.216.220.27:8004/SlowUploadService/SlowUploadService?xsd=1 // Encoding : UTF-8 // Version : 1.0 // (2014-09-22 15:37:34 - - $Rev: 10138 $) // ************************************************************************ //unit SlowUploadService1;interfaceuses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;const IS_OPTN = $0001; IS_NLBL = $0004; IS_UNQL = $0008; 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. // ************************************************************************ // // !:base64Binary - "http://www.w3.org/2001/XMLSchema"[Gbl] // !:string - "http://www.w3.org/2001/XMLSchema"[Gbl] // ************************************************************************ // // Namespace : http://service.cz.slowup.chis.com/ // transport : http://schemas.xmlsoap.org/soap/http // style : document // binding : SlowUploadServicePortBinding // service : SlowUploadService // port : SlowUploadServicePort // URL : http://58.216.220.27:8004/SlowUploadService/SlowUploadService // ************************************************************************ // SlowUploadService = interface(IInvokable) ['{2C40B69E-7CB9-F1B6-9360-51C42A807B23}'] function uploadSlowCase(const arg0: WideString; const arg1: WideString; const arg2: TByteDynArray): TByteDynArray; stdcall; end;function GetSlowUploadService(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): SlowUploadService; implementation uses SysUtils;function GetSlowUploadService(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): SlowUploadService; const defWSDL = 'http://58.216.220.27:8004/SlowUploadService/SlowUploadService?WSDL'; defURL = 'http://58.216.220.27:8004/SlowUploadService/SlowUploadService'; defSvc = 'SlowUploadService'; defPrt = 'SlowUploadServicePort'; 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 SlowUploadService); 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(SlowUploadService), 'http://service.cz.slowup.chis.com/', 'UTF-8'); InvRegistry.RegisterDefaultSOAPAction(TypeInfo(SlowUploadService), ''); InvRegistry.RegisterInvokeOptions(TypeInfo(SlowUploadService), ioDocument);end.
delphi7和XE的编译环境不一样了。像有些数据类型的长度等产生了变化
InvRegistry.RegisterInvokeOptions(TypeInfo(xxxxxxxxServiceSoap), ioDocument);
改一下ioDocument这个参数,如果没有加上这一句,然后在改一下试试!参数为空一般情况是这里的问题。
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : http://58.216.220.27:8004/SlowUploadService/SlowUploadService?WSDL
// >Import : http://58.216.220.27:8004/SlowUploadService/SlowUploadService?WSDL:0
// >Import : http://58.216.220.27:8004/SlowUploadService/SlowUploadService?xsd=1
// Encoding : UTF-8
// Version : 1.0
// (2014-09-22 15:37:34 - - $Rev: 10138 $)
// ************************************************************************ //unit SlowUploadService1;interfaceuses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;const
IS_OPTN = $0001;
IS_NLBL = $0004;
IS_UNQL = $0008;
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.
// ************************************************************************ //
// !:base64Binary - "http://www.w3.org/2001/XMLSchema"[Gbl]
// !:string - "http://www.w3.org/2001/XMLSchema"[Gbl] // ************************************************************************ //
// Namespace : http://service.cz.slowup.chis.com/
// transport : http://schemas.xmlsoap.org/soap/http
// style : document
// binding : SlowUploadServicePortBinding
// service : SlowUploadService
// port : SlowUploadServicePort
// URL : http://58.216.220.27:8004/SlowUploadService/SlowUploadService
// ************************************************************************ //
SlowUploadService = interface(IInvokable)
['{2C40B69E-7CB9-F1B6-9360-51C42A807B23}']
function uploadSlowCase(const arg0: WideString; const arg1: WideString; const arg2: TByteDynArray): TByteDynArray; stdcall;
end;function GetSlowUploadService(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): SlowUploadService;
implementation
uses SysUtils;function GetSlowUploadService(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): SlowUploadService;
const
defWSDL = 'http://58.216.220.27:8004/SlowUploadService/SlowUploadService?WSDL';
defURL = 'http://58.216.220.27:8004/SlowUploadService/SlowUploadService';
defSvc = 'SlowUploadService';
defPrt = 'SlowUploadServicePort';
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 SlowUploadService);
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(SlowUploadService), 'http://service.cz.slowup.chis.com/', 'UTF-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(SlowUploadService), '');
InvRegistry.RegisterInvokeOptions(TypeInfo(SlowUploadService), ioDocument);end.