Published properties are not displayed in Delphi web service wsdl

The class TMyClass from my interface file is derived from its parent class TMyRemotable, which in turn is derived from TRemotable.

The problem with the generated WSDL is that the published properties of TMyClass are not displayed in the <complex> type.

Consider the code snippets below:


TMyRemotable = class(TRemotable)
  class function NewInstance: TObject; override;
  destructor Destroy; override;

UserIntf.pas //Interface file

TMyClass = class(TMyRemotable)
  FUserName: string;
  FpassWord: string;  
  property UserName: string read FUserName write FUserName;
  property Password: string read FpassWord write FpassWord;

We get this output:

  <xs:schema xmlns="urn:UserIntf" targetNamespace="urn:UserIntf">
    <xs:complexType name="TMyClass">

Expected output:

  <xs:schema xmlns="urn:UserIntf" targetNamespace="urn:UserIntf">
    <xs:complexType name="TMyClass">
        <xs:element name="UserName" type="xs:string"/>
        <xs:element name="PassWord" type="xs:string"/>

Kindly guide me to how to include the published properties in the generated WSDL file.

- - Source


answered 6 day ago SilverWarior #1

If you want your properties to appear as element nodes or attributes in the corresponding SOAP encoding of the type, you need to use a bit of a different declaration for them. They actually need to be declared as indexed properties, like this:

  property Text: WideString index IS_TEXT read FText write FText;

You can read more about this in Embarcadero's official documentation:

Using Remotable Objects

comments powered by Disqus