Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do i use arrays in Delphi SOAP services?

1,646 views
Skip to first unread message

John Ray

unread,
Aug 17, 2001, 8:14:50 AM8/17/01
to
I have a web service written in Delphi 6, and I would like to add a method
that returns an array of strings (the array can be of any length, including
empty) as a var-parameter or a function result. What is the best way to
declare this in the Delphi interface code, and are there different
considerations or gotchas if the web service client is using delphi or
another language (say .NET!) with respect to how Delphi maps arrays to SOAP
arrays?

/John

Shiv Kumar

unread,
Aug 17, 2001, 10:30:16 AM8/17/01
to
John,

Take a look at my web site for an example of this kind of thing. The
Tutorial is called - WebServices and ComplexTypes. Your second question will
be answered there as well. I suggest reading the previous tutorials too.
You'll get a better understanding of what is going on.

--
Shiv Kumar
The Delphi Apostle
http://www.matlus.com:8080
http://www.delphisoap.com:8080


John Ray

unread,
Aug 19, 2001, 11:14:24 AM8/19/01
to
Shiv,

Good article. I downloaded your project and tried using the same techniques,
but am running in to some problems relating to the WSDL that Delphi 6
automagically generates. So I tried compiling your project and querying the
compiled ISAPI DLL for its WSDL, and got the same problem: the problem being
that Delphi does not generate the WSDL that you published in you article, or
that you get from following the WSDL-link in your article! In particular, it
doesn't generate the description of the complex type:

- <xs:complexType name="TFieldInfoArray">
- <xs:complexContent>
- <xs:restriction base="soapenc:Array">
<xs:sequence />
<xs:attribute ref="soapenc:arrayType" n1:arrayType="xs:TFieldInfo[]"
xmlns:n1="http://schemas.xmlsoap.org/wsdl/" />
</xs:restriction>
</xs:complexContent>
</xs:complexType>
- <xs:complexType name="TFieldInfo">
- <xs:sequence>
<xs:element name="FieldName" type="xs:string" />
<xs:element name="FieldType" type="xs:string" />
<xs:element name="FieldSize" type="xs:int" />
<xs:element name="IsKeyField" type="xs:boolean" />
</xs:sequence>
</xs:complexType>
</xs:schema>
...
- <message name="GetSchemaInfoResponse">
<part name="return" type="xs:TFieldInfoArray" />
</message>


Instead, it just generates:

- <message name="GetSchemaInfoResponse">
<part name="return" type="xs:TFieldInfoArray" />
</message>

Thus, importing the WSDL genrates an unresolved type definition
(TFieldInfoArray), and no definition whatsoever of TFieldInfo.

What is the problem? Are you using a patched version of the Delphi classes,
or is your ISAPI DLL not doing the standard stuff when returning its WSDL,
or am I completely confused?

/John

"Shiv Kumar" <sh...@erols.com> wrote in message news:3b7d2a96_1@dnews...

Shiv Kumar

unread,
Aug 19, 2001, 12:08:10 PM8/19/01
to
John,

Yes, I'm sorry, I should have mentioned that in the Tutorial. It has been a
while since I fixed that (the fix is unofficial mind you).

Take a look at the fix I've made to the WebServExp.pas unit.

function TWebServExp.FindSchema(const ObjectTypeInfo: PTypeinfo; const
TnsURI: string): Boolean;
var
Index: Integer;
begin

Result := False;

//Do not register Empty TnsURI or tkSet or any predefined type from
XMLSchema
{ TODO -oShiv Kumar -cBUG :
Complex Types are not generated if this code is NOT commented.
Don't know the implications of doing this, but so far have not had issues. }

{ if ((TnsURI = '') or (ObjectTypeInfo.Kind = tkSet) or (TnsURI =
SXMLSchemaURI_1999) or (TnsURI = SXMLSchemaURI_2000_10) or
(TnsURI = SXMLSchemaURI_2001)) then
begin
Result := True;
Exit;
end;
}
for Index := 0 to Length(SchemaArray) -1 do
begin
if SchemaArray[Index].TypeInfo = ObjectTypeInfo then
begin
Result := True;
Exit;
end;
end;

//Add new type
Index := Length(SchemaArray);
SetLength(SchemaArray, Index+1);
SchemaArray[Index].TypeName := ObjectTypeInfo.Name;
SchemaArray[Index].NameSpace := TnsURI;
SchemaArray[Index].TypeInfo := ObjectTypeInfo;
SchemaArray[Index].XSGenerated := False;
end;

Shiv Kumar

unread,
Aug 19, 2001, 12:27:46 PM8/19/01
to
I've added a note to this effect in the tutorial as well. Thanks for the
"reminder".

John Ray

unread,
Aug 19, 2001, 3:53:53 PM8/19/01
to
No problem. Now my project and your source code generate much nicer WSDL.

/John

"Shiv Kumar" <sh...@erols.com> wrote in message news:3b7fe919_1@dnews...

0 new messages