1,593
社区成员
发帖
与我相关
我的任务
分享
string userName = "123";
string paw = "123";
WST ws = new WST();
ws.Credentials = new NetworkCredential(userName, paw, "aaa");
string resp =ws.WSTEST("321");
function GetWST_Port(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): WST_Port;
const
defWSDL = '';
defURL = '';
defSvc = 'WST';
defPrt = 'WST_Port';
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 WST_Port);
if UseWSDL then
begin
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
RIO.HTTPWebNode.UserName := '123';
RIO.HTTPWebNode.Password := '123';
end
else
RIO.URL := Addr;
finally
if (Result = nil) and (HTTPRIO = nil) then
RIO.Free;
end;
end;
RIO.WSDLLocation := Addr;
RIO.Service := defSvc;
RIO.Port := defPrt;
RIO.HTTPWebNode.UserName := '123';
RIO.HTTPWebNode.Password := '123';
RIO.HTTPWebNode.域 :='***'; //所有的验证都应该挂载在这个对象里吧?
不明白你说的去 Windows api 中什么对象和请求有关联
function GetWeatherWebServiceSoap(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): WeatherWebServiceSoap;
const
defWSDL = 'http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl';
defURL = 'http://www.webxml.com.cn/WebServices/WeatherWebService.asmx';
defSvc = 'WeatherWebService';
defPrt = 'WeatherWebServiceSoap';
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 WeatherWebServiceSoap);
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(WeatherWebServiceSoap), 'http://WebXml.com.cn/', 'utf-8');
InvRegistry.RegisterDefaultSOAPAction(TypeInfo(WeatherWebServiceSoap), 'http://WebXml.com.cn/%operationName%');
RemClassRegistry.RegisterXSInfo(TypeInfo(ArrayOfString), 'http://WebXml.com.cn/', 'ArrayOfString');
RemClassRegistry.RegisterXSClass(getSupportDataSetResult, 'http://WebXml.com.cn/', 'getSupportDataSetResult');