I made a standalone SOAP WebService.
I created a Class(TRemotable)
:
TFornecedor = Class(TRemotable)
private
Fsistema : Integer;
Facao : AnsiString;
Fcodigo : AnsiString;
FFantasia : AnsiString;
published
property cd_sistema : Integer read Fcd_sistema write Fcd_sistema;
property tx_acao : AnsiString tread Ftx_acao write Ftx_acao;
property cd_codigo : AnsiString read Fcd_codigo write Fcd_codigo;
property Fantasia: AnsiString read FFantasia write FFantasia ;
End;
No problem, but I do not know how to tell the size of each field. Type ... field Facao
is varchar 3
, Ffantasia
is varchar 35
.
Theoretically (I say theoretically because I do not dominate SOAP
) I have to inform the sizes for the future client that consume .WSDL
to visualize the types and sizes and to be able to make its implementation.
If it were a "normal" application (without being SOAP
) I would make the following code and would function normally:
type
TFacao = String[3];
TFcodigo = String[10];
TFFantasia = String[35];
TFornecedor = Class(TRemotable)
private
Fcd_sistema : Integer;
Ftx_acao : TFacao;
Fcd_codigo : TFcodigo;
Ftx_razaosocial : TFFantasia;
published
property cd_sistema : Integer read Fcd_sistema write Fcd_sistema;
property tx_acao : TFacao read Ftx_acao write Ftx_acao;
property cd_codigo : TFcodigo read Fcd_codigo write Fcd_codigo;
property tx_razaosocial : TFFantasia read Ftx_razaosocial write Ftx_razaosocial;
End;
However, doing so in a SOAP
application, when the client takes the .WSDL
, when implementing, it does not display the field size information. Actually even error because TFacao
, TFcodigo
and TFFantasia
do not appear in .WSDL
. And when it (he = I = made a client application and after importing .WSDL
into the browser, I had to declare the types TFacao
, TFCodigo
and TFFantasia
) send the provider with a length greater than allowed gives error.
I know I could treat in the service at the time of adding the record:
Qy_Fornecedor.ParamByName('acao').AsString:= Copy(TFornecedor.Tx_Acao,1,3)
But taking some .WSDL
on the net I saw this as follows (the code below has been rewritten for the fields I have):
</s:element>
<s:simpleType name="sistema">
<s:restriction base="s:integer">
<s:minLength value="1"/>
<s:maxLength value="2"/>
</s:restriction>
</s:simpleType>
<s:simpleType name="acao">
<s:restriction base="s:string">
<s:enumeration value="ADD"/>
<s:enumeration value="DEL"/>
<s:enumeration value="CHG"/>
</s:restriction>
</s:simpleType>
<s:simpleType name="fantasia">
<s:restriction base="s:string">
<s:minLength value="1"/>
<s:maxLength value="35"/>
</s:restriction>
So, my question actually is:
How can I tell the type and size of the fields in a class TRemotable
SOAP
to the future client How do I download the .WSDL
view them as the example just above?