Board index » delphi » SOAP client working example for D7

SOAP client working example for D7


2005-12-18 02:47:45 AM
delphi14
Anybody with working example of SOAP client for Delphi 7 (to somewhere on the net)
?
PostSOAP demo gives me time-out.
SAM's BabelFish - invalid character
thanks
Teodor
 
 

Re:SOAP client working example for D7

Teodor Krastev writes:
Quote
Anybody with working example of SOAP client for Delphi 7 (to somewhere on the net)
?

PostSOAP demo gives me time-out.

SAM's BabelFish - invalid character

thanks
Teodor


Use the wizard (File|New|Other|WebServices|WSDL IMPORT) to get the WSDL
at: www.webservicex.com/stockquote.asmx?WSDL
Then put a button and a statictext on your form and call this:
procedure TForm1.QuoteButtonClick(Sender: TObject);
var
StockQuoteSoapData: StockQuoteSoap;
symbol,
price,
s: String;
head,
tail: integer;
begin
StockQuoteSoapData := GetStockQuoteSoap;
s := StockQuoteSoapData.GetQuote('RHAT');
head := pos('<Symbol>',s);
tail := pos('</Symbol>',s);
symbol := copy(s,head + 8, tail - (head + 8));
head := pos('<Last>',s);
tail := pos('</Last>',s);
price := copy(s,head + 6, tail - (head + 6));
QuoteStaticText.Caption := symbol + ' = $' + price;
end;
in the OnClick handler of your button.
JAS