简体   繁体   中英

Return an array list from java servlet to C#

After much struggling, i have come to a design dead end :( seeing as i am a student, and all my bosses have buggered of for christams i have no one to ask!

I have managed to make my servlet process the required information, based on a parameter passed in and put it all in to a arraylist of my own class design.

for example class a has 7 strings and 1 array, and i have an arraylist of

The issue is, now i need to return this information to c#, c# is going to have no idea about class a, as well as probably having different implementation/understanding of an array list :(

What can i do to get the data in a format the is exchangable?

Thanks for the help

Your best bet is to encode them as name/value parameter strings and encode them in the HTTP response. Let the HTTP client, be it written in C# or any other language, fetch the values out of the response stream.

Another choice would be to serialize the objects as XML and send that back. Or perhaps JSON will work.

But you are correct - clients will only know HTTP, not Java or C# classes.

通过文件,套接字或Web服务进行通信。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM