开发者

Best practice to define multi-dimensional arrays in wsdl

I'm developing a WebService with a function which returns a database result, which means an MxN array. My question is, what's the better way to define this in wsdl:

  1. Define a row as sequence of (string) columns, define the resultset as sequence of rows, put this resultset into a message
  2. Define a row as sequence of (string) columns, put a sequence of such rows into the开发者_运维知识库 message directly

So is it better/cleaner/nicer to wrap the rows into an own datatype and put this one into the response message or leave the own datatype and put the row-sequence directly into the message?

Thank you!


For the row you define an element which has as children elements coresponding to the columns of the result.

<row>
    <field1>...</field1>
    <field2>...</field2>
    ...
    <fieldN>...</fieldN>
</row>

You then return a wrapped list of row elements.

<rows>
    <row>
      ...
    </row>
    <row>
      ...
    </row>
    ...
    <row>
      ...
    </row>
</rows>

(I'm using row/rows here for simplicity. You can name the element whatever you want, normally a name that reflects the what the data in the row represents).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜