Link to home
Start Free TrialLog in
Avatar of bilgehanyildirim
bilgehanyildirim

asked on

Delphi 2005 and WSDL

Hi there,
I am looking for a sample code in Delphi 2005 which will use the following wsdl
http://gw1.aql.com/soap/sendservice.php?WSDL 

thanks
Bill
Avatar of Jacco
Jacco
Flag of Netherlands image

Hi there,

I created a WinForms .NET application. On the form I added a button and two TextBox components.

The following code calls the webservice:

procedure TWinForm.Button1_Click(sender: System.Object; e: System.EventArgs);
var
  Sms: com.aql.gw1.sendservice.SendSmsService;
  dest: array of string;
  cb: callbackelement;
  credit, desc: string;
begin
  Sms := com.aql.gw1.sendservice.SendSmsService.Create;
  Sms.authValue := auth.Create;
  Sms.authValue.username := 'Jacco';
  Sms.authValue.password := 'test';
  SetLength(dest, 1);
  dest[0] := '+yourphone';
  cb := callbackelement.Create;
  cb.callbackurl := 'www.google.nl';
  cb.callbacktype := com.aql.gw1.sendservice.callbacktypeoptions.NONE;
  Sms.SoapSendSms(dest, '+yourotherphone', 'Message from Delphi 2005!', com.aql.gw1.sendservice.text, '', System.DateTime.Now, True, cb, credit, desc);
  TextBox1.Text := desc;
  TextBox2.Text := credit;
  Sms.Free;
end;

Replace +yourphone and +yourotherphone by valid phonenumbers
Replace the username and password with the ones you received aql.com

And it should work.

I got an error saying that my username and password were wrong.

Regards Jacco
Oh yeah, after creating the .NET WinForms application I right clicked the project, did add web reference, save the project an entered the WDSL address so the correct web service files are created.

Regards Jacco
Avatar of bilgehanyildirim
bilgehanyildirim

ASKER

I tried that but whenever I tried to run it opened the
C:\Documents and Settings\Bill\My Documents\Borland Studio Projects\SMS\Web References\com.aql.gw1\com.aql.gw1.sendservice.pas
and went to line 40
[System.Xml.Serialization.XmlEnumAttribute('7')]
and said
"E2029 Identifier Expected  but '[' found"

Did it give the same error on your project?
and did you put
uses com.aql.gw1.sendservice;
after
implementation taq

?
I commented them out. Probabbly not a good idea. Sorry, I forgot to mention that. It might not work then. Let me know because I think I know a way around that. Delphi doesn't seem to know about these attributes.

Regards Jacco
which part did you comment out?
ASKER CERTIFIED SOLUTION
Avatar of Jacco
Jacco
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I changed the code a litte bit
procedure TWinForm.Button1_Click(sender: System.Object; e: System.EventArgs);
var
  Sms: gw11.sendservice.SendSmsService;
  dest: array of string;
  cb: callbackelement;
  credit, desc: string;
begin
  Sms := gw11.sendservice.SendSmsService.Create;
  Sms.authValue := auth.Create;
  Sms.authValue.username := 'xxx';
  Sms.authValue.password := 'xxx';
  SetLength(dest, 1);
  dest[0] := '+xxxxx;
  cb := callbackelement.Create;
  cb.callbackurl := 'www.google.nl';
  cb.callbacktype := callbacktypeoptions(none);
  Sms.SoapSendSms(dest, '+xxxxx, 'Message from Delphi 2005!', gw11.sendservice.text, '1', System.DateTime.Now, True, cb, credit, desc);
  TextBox1.Text := desc;
  TextBox2.Text := credit;
  Sms.Free;
end;

and it worked perfect!!!!

All points are yours.
thanks a lot!