Summary of Web Method in Web Services (1)

xiaoxiao2021-03-05  32

In recently, WebService is used, where parameters are customized.

ActionForm type, actually a collection of properties consisting of simple types.

The return value is a custom type: ValueObject. Due to experience,

The ValueObject type is too complicated. In order to return the result set of the database query,

It contains one or more DataSets. We know that DataSet can be

WebMethod returns no problem, but DataTable is not.

BUT ...

In general, parameters as a function of WebService also return values ​​should try to use simple types or arrays from simple types, do not use complex types that are like DataSet, because this situation usually other languages And tools are unable to process.

For example, DataSet, the XML generated by default will be a very strange structure, including an XMLschema defines the structure of the Table, and a specific rule XML node. Even if the Client tool can help you create a structure that accepts the DataSet, its verification and data read work should be done. And this approach is low even in Server end efficiency. A better way is to define the tablet's table as a structure and return an array of the structure, which is basically any language and tools that can be handled correctly.

转载请注明原文地址:https://www.9cbs.com/read-33876.html

New Post(0)