DataSet returned by the. NET Web service is called in other languages (JAVA ).

Source: Internet
Author: User

Java does not have the built-in DataSet class of DotNet and cannot be parsed. Although some DataSet classes similar to Java on the internet can solve this problem, it is best to use the standard method.

Solution:

The WebService function returns an xml string, and the xml string generated by DataSet is declared using the anonymous schema type.

Therefore, you must use a simple data type or an array of simple data types.

There are three solutions to minimize changes to the original code.

1. The server returns a string and the content is an xml string. You can use the DataSet. GetXml () method.

The number of server changes is small.

The corresponding client needs to read the xml string by itself.

2. The returned result is an array of classes containing simple data types. However, the server must map all fields in the DataSet to an array.

The client can easily read data.

The number of changes made by the server is slightly larger. If there are many fields, it will be troublesome.

3. When the server returns a large amount of data DataSet, the compression technology can be used to return the Byt [] binary array and compress the data for transmission.

Summary:

When the WebService transmits data, the parameter type is preferably a simple data type or an xml string.

This avoids compatibility issues (cross-language) between systems ).

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.