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:

Sample.pas

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

UserIntf.pas //Interface file

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

We get this output:

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

Expected output:

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

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

- - Source

Answers

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:

published
  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