Axort
Axort

Reputation: 2024

How can I put a HashMap as an input in a Java Web Service?

I'm getting this error:

The service class "myclass" does not comply to one or more requirements of the JAX-RPC 1.1 specification, and may not deploy or function correctly. The method "mymethod" on the service class "myclass" uses a data type, "java.util.Map", that is not supported by the JAX-RPC specification. Instances of the type may not serialize or deserialize correctly. Loss of data or complete failure of the Web service may result.

So, I don't know how to use that type of data, as an input I have this:

Map<String, String>[] complex

I put it as an Array because Tibco (An integration tool) couldn't see the hashmap as various elements.

Thanks in advance!

Upvotes: 0

Views: 4449

Answers (3)

nsfyn55
nsfyn55

Reputation: 15363

Map is an interface so you can't use it,but you can use one of the supported implementation classes below:

Refer to this link for supported implementation classes - section entitled JAX-RPC type support

Supported Types: http://sentex.net/~pkomisar/WS/WS_8_JAX-RPC.html

Upvotes: 0

jtahlborn
jtahlborn

Reputation: 53694

As a side note, if you are writing a new webservice, you should consider using a moderately recent technology. jax-rpc is very outdated and uses soap encodings that are very painful to work with. consider using jax-ws (built into the jdk these days) or some other webservices implementation which uses document-literal encoding.

Upvotes: 1

dringess
dringess

Reputation: 1

Web services are supposed to be interoperable across programming languages and java.util.Map is Java-specific. You should write a facade for that method that converts the contents of the Map into an array.

Upvotes: 0

Related Questions