I used the WSDL importer with Delphi XE2, and it generated a routine that looks like this, with the exception of three comments in which I am trying to use a proxy server.
function GetIXYZService(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): IXYZService; const defWSDL = 'https://server/XYZService.svc?wsdl'; defURL = 'https://server/XYZService.svc'; defSvc = 'Company.XYZ.Services.XYZService'; defPrt = 'BasicHttpBinding_IXYZService'; 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 // RIO.HTTPWebNode.Proxy := 'server_ip:port'; // RIO.HTTPWebNode.Username := 'username'; // RIO.HTTPWebNode.Password := 'password'; Result := (RIO as ISSOService); 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;
I need to access the service through an authentication proxy. I added 3 lines shown above, and when I uncomment them, I cannot connect. Help for THTTPRio states ...
If you need to use a proxy server or require an authentication server, use the properties of the THTTPReqResp object, which is the value of the HTTPWebNode property to provide the necessary information.
I did this, but when I try to use my service, an ESOAPHTTPException is thrown with a message ...
Unauthorized (407) - 'https://server/XYZService.svc'
I stumbled upon this post which says to set proxy settings after installing WSDLLocation, service and port, which I tried without success.
http://www.delphigroups.info/2/10/555621.html
I also do not build with USE_INDY. My service uses SSL, so I use WinInet.
I am not sure what is wrong with this approach, so any help is appreciated.
Thanks Michael
Michael S.
source share