开发者

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开发者_如何学Python 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!


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.


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.


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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜