Board index » delphi » Problem using WideString in imported WSDL

Problem using WideString in imported WSDL


2008-07-09 06:24:30 PM
delphi27
Hello,
I'm quite new to webservices and having a problem with an imported WSDL (in
delphi 7) from a webservice created in .Net.
The imorted WSDL has an interface like this:
TestServiceContract = interface(IInvokable)
['{8FEDD6AB-DFED-35F6-1474-7D4E3EF844F5}']
procedure Bounce(var string_: WideString); stdcall;
end;
But when i try to use this interface as mentioned below I get the error
'Incompatible types: 'String' and 'procedure, untyped pointer or untyped
parameter'.
procedure TForm1.FormCreate(Sender: TObject);
var
s: WideString;
begin
s := 'Test';
Label1.Caption :=
(HTTPRIO1 as TestServiceContract).Bounce(s);
end;
Testing a webservice made in Delphi 7 was no problem. Besides the fact that
it doesn't work, I simply don't understand this error message at this
point..
Hope someone can point me in the right direction.
TIA,
Erik Schuurman
 
 

Re:Problem using WideString in imported WSDL

Hi!
Quote
TestServiceContract = interface(IInvokable)
['{8FEDD6AB-DFED-35F6-1474-7D4E3EF844F5}']
procedure Bounce(var string_: WideString); stdcall;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
s: WideString;
begin
s := 'Test';
Label1.Caption :=
(HTTPRIO1 as TestServiceContract).Bounce(s);
end;

Bounce is a procedure and not a function. So it cannot rerutns a string to
put in the caption property of the label.
So the compiler is trying to set the procedure bounce to the caption
property.
HTH!
VB
 

Re:Problem using WideString in imported WSDL

Hi!
Thanx for the reply, it is just that I copied the wrong the Interface (not
very smart of me). The posted Interface was the original, but since it was
giving problems with the 'var string_' I let it change to a 'const string_'
and return a value as a function :)
And that seems to solve the problem, so there is a problem with using 'var
string_' in the interface somehow.
Thanx anyway for your help!
Regards,
Erik
"Vincent Bergeron" <XXXX@XXXXX.COM>writes
Quote
Hi!

>TestServiceContract = interface(IInvokable)
>['{8FEDD6AB-DFED-35F6-1474-7D4E3EF844F5}']
>procedure Bounce(var string_: WideString); stdcall;
>end;
>
>procedure TForm1.FormCreate(Sender: TObject);
>var
>s: WideString;
>begin
>s := 'Test';
>Label1.Caption :=
>(HTTPRIO1 as TestServiceContract).Bounce(s);
>end;
>

Bounce is a procedure and not a function. So it cannot rerutns a string to
put in the caption property of the label.

So the compiler is trying to set the procedure bounce to the caption
property.

HTH!

VB

 

Re:Problem using WideString in imported WSDL

Hi Erik,
Quote
very smart of me). The posted Interface was the original, but since it was
giving problems with the 'var string_' I let it change to a 'const string_'
and return a value as a function :)
I wonder: what was the problem you encountered when using the "var
string_: WideString" parameter?
Quote
Regards,
Erik
Groetjes,
Bob Swart
--
Bob Swart Training & Consultancy (eBob42.com) Forever Loyal to Delphi
CodeGear Technology Partner -- CodeGear RAD Studio Reseller (BeNeLux)
Personal courseware + e-mail support www.ebob42.com/courseware
Blog: www.drbob42.com/blog - RSS: eBob42.com/weblog.xml
 

Re:Problem using WideString in imported WSDL

Can't reproduce it anymore :(
But it had something to do during compile time, kept nagging me with saying
something like WideString and Pointer are not compatible. And I was sure I
was passing a WideString variable.
Guess it was my inexperience at the time since I can not get that error
anymore ;-)
Groeten,
Erik
"Bob Swart" <XXXX@XXXXX.COM>writes
Quote
Hi Erik,

>very smart of me). The posted Interface was the original, but since it
>was giving problems with the 'var string_' I let it change to a 'const
>string_' and return a value as a function :)

I wonder: what was the problem you encountered when using the "var
string_: WideString" parameter?

>Regards,
>Erik

Groetjes,
Bob Swart

--
Bob Swart Training & Consultancy (eBob42.com) Forever Loyal to Delphi
CodeGear Technology Partner -- CodeGear RAD Studio Reseller (BeNeLux)
Personal courseware + e-mail support www.ebob42.com/courseware
Blog: www.drbob42.com/blog - RSS: eBob42.com/weblog.xml