Hi,
I'm trying to write a really simple SOAP client, to send SMS's with.
At least, it's really simple in THEORY.

My code is below, I checked it - in string the content is perfect, and it is posting. But it kept failing, so enventualy I sniffed it, it's POSTING it as garbage - it looks like ansi-text being read by a UTF reader but it could be something else.


My best theory is that my document.write call is broken - I translated that one from the synapse Delphi example - any suggestions ?

A.J.

procedure TForm1.Button1Click(Sender: TObject);
begin
    S := S+'<?xml version="1.0" encoding="utf-8"?>';

S := S+'<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope";';
    S := S+' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";';
    S := S+'xmlns:xsd="http://www.w3.org/2001/XMLSchema";>';

    S := S + '<soap:Body><SendSMS xmlns=http://tempuri.org/>';
    S := S+ '<numbers>'+Edit1.Text+'</numbers>';
    S := S+'<message>'+Memo1.Lines.Text+'</message>';
    S := S+'</SendSMS></soap:Body></soap:Envelope>';

  HTTP := THTTPSend.Create;
  U := AnsiToUTF8(S);
      HTTP.Document.StrWrite(Pchar(U));

  l := TStringList.create;
  try
if not HTTP.HTTPMethod('POST','http://10.0.88.123/hs_cell/hs_cell.asmx?op=SendSMS') then
      begin
        showMessage('ERROR');
        writeln(Http.Resultcode);
      end
    else
      begin
        writeln(Http.Resultcode, ' ', Http.Resultstring);
        writeln;
        showMessage(Http.headers.text);
        writeln;
        l.loadfromstream(Http.Document);
        showMessage(S+LineEnding+LineEnding+l.text);
     end;
  finally
    HTTP.Free;
    l.free;
  end;
end;

--
"Any sufficiently advanced technology is indistinguishable from magic" - Clarke's law "Any technology that is distinguishable from magic is insufficiently advanced" -Gehm's corollary "Any technologist that is distinguishable from a magician is insufficiently advanced" - My corollary
The worlds worst webcomic: http://silentcoder.co.za/scartoonz
The worlds best cybercafe manager: http://outkafe.outkastsolutions.co.za

begin:vcard
fn:AJ Venter
n:Venter;AJ
org:Global Pact Trading Pty. Ltd.;OutKast Solutions
email;internet:[EMAIL PROTECTED]
title:Director of Product Development
tel;work:+27 21 554 5059
tel;fax:+27 21 413 2800
tel;cell:+27 83 455 9978
url:http://www.outkastsolutions.co.za
version:2.1
end:vcard

Reply via email to