How to pass java.util.Map through a web service?

My method returns Map<Integer, String[]> . Can I pass it to a web service?

+6
source share
2 answers

It’s best not to open Java collections through the web service interface.

Instead, you should expose only simple types, beans, and arrays, or you run the risk of getting into trouble (interaction problem).

Try converting your Map into an array, for example, a Map.Entry s array or something that wraps these entries.

+3
source

The map is specific to java ..

You can only use arrays, int, string .. everything that is common to all other languages ​​that webservices can use (PHP, C #, C ++, etc.) ... And think about it ... What is Map in PHP? no ... web services are built to exchange data in several languages ​​...

If you want to use it with Map and use this application only for java, you are better off using RMI, not WebServices

+3
source

Source: https://habr.com/ru/post/899114/


All Articles