在delphi7中,new-webservices-wsdl importer中輸入wsdl地址,會自動生成wsdl單元代碼。
在調用時,傳入參數到服務器端時為空了。
網上說缺少
InvRegistry.RegisterInvokeOptions(TypeInfo(ServiceRS_JGXXPortType), ioDocument);
這句,可是我的代碼里都有的。
以下是代碼里的前四句
InvRegistry.RegisterInterface(TypeInfo(ServiceRS_JGXXPortType), 'http://release.service.das.jeaw.com', 'UTF-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(ServiceRS_JGXXPortType), 'urn:%operationName%');
InvRegistry.RegisterInvokeOptions(TypeInfo(ServiceRS_JGXXPortType), ioDocument);
InvRegistry.RegisterInvokeOptions(TypeInfo(ServiceRS_JGXXPortType), ioLiteral);
請高人指點下,為什么傳入參數為空?
解答:
加上最后一句試試
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;
RIO.HTTPWebNode.UseUTF8InHeader:= True;//加上這句
InvRegistry.RegisterInvokeOptions(TypeInfo(WebService1Soap),ioDocument);
這其中,WebService1Soap是你的對象名.按自己的情況改就是了.