• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1166
  • Last Modified:

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
0
bilgehanyildirim
Asked:
bilgehanyildirim
  • 4
  • 4
1 Solution
 
JaccoCommented:
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
0
 
JaccoCommented:
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
0
 
bilgehanyildirimAuthor Commented:
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?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
bilgehanyildirimAuthor Commented:
and did you put
uses com.aql.gw1.sendservice;
after
implementation taq

?
0
 
JaccoCommented:
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
0
 
bilgehanyildirimAuthor Commented:
which part did you comment out?
0
 
JaccoCommented:
All the lines with attribute definitions like this one:

//    [System.Xml.Serialization.XmlEnumAttribute('7')]

in com.aql.gw1.sendservice.pas

There were about six of them.

Regards Jacco

0
 
bilgehanyildirimAuthor Commented:
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!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now