Redian新闻
>
web service returns HashMap that contains multiple ArrayList
avatar
web service returns HashMap that contains multiple ArrayList# Java - 爪哇娇娃
m*o
1
Working on converting a rmi call to web service. The converting itself is no
big deal until I found out the returned value is a HashMap that has 7
ArrayLists. Each of these ArrayList has multiple 'regular' objects (A class
that describes a working shift), and each of these objects contains two more
ArrayLists, one contains classes that describe each segment of this shift
and the other describes related breaks and lunches, etc.
I plan to go the dumb way to convert this stupid thing to a big Strin
avatar
t*e
2
The Java2WSDL approach doesn't work for you?
avatar
m*o
3
I created the web service using annotation @WebService, etc. It appears that
a wsdl file is created automatically when the code is deployed within JBoss
. The wsdl file specifies that the return type of this web service method
would be 'hashMap'. However when the method is being called, an error is
thrown saying 'hashMap' is not a recognized type. I googled around and it
does look like HashMap,ArrayList etc. are no longer supported by current web
service specification. I assume java2wsdl would f

【在 t*******e 的大作中提到】
: The Java2WSDL approach doesn't work for you?
avatar
g*g
4
Convert it to big string is too much of a hassle, if
Map is not supported, 2 arrays, one for key, one for values
will do the job fine.

that
JBoss
web
if

【在 m******o 的大作中提到】
: I created the web service using annotation @WebService, etc. It appears that
: a wsdl file is created automatically when the code is deployed within JBoss
: . The wsdl file specifies that the return type of this web service method
: would be 'hashMap'. However when the method is being called, an error is
: thrown saying 'hashMap' is not a recognized type. I googled around and it
: does look like HashMap,ArrayList etc. are no longer supported by current web
: service specification. I assume java2wsdl would f

avatar
m*o
5
Are you saying to have a wrapper class that contains two arrays? Would it
work if each element of the value array also contains the unsupported
ArrayList?

【在 g*****g 的大作中提到】
: Convert it to big string is too much of a hassle, if
: Map is not supported, 2 arrays, one for key, one for values
: will do the job fine.
:
: that
: JBoss
: web
: if

avatar
g*g
6
I would think so. You probably can find out faster than
I type.

【在 m******o 的大作中提到】
: Are you saying to have a wrapper class that contains two arrays? Would it
: work if each element of the value array also contains the unsupported
: ArrayList?

avatar
m*o
7
I tried to return just one array (EmployeeDetail[]) the other day but this
line
Service service = factory.createService(url, qname);
throws an exception saying I got duplicate member fields. Apparently it did
not differentiate EmployeeDetail and EmployeeDetail[]. (Or I failed to
supply it with the information) Right now I am trying to avoid adding extra
wsdl at the client (caller) side but that's probably necessary if any of the
non-standard types are involved.
Since I got a due date by the end

【在 g*****g 的大作中提到】
: I would think so. You probably can find out faster than
: I type.

avatar
Q*g
8
how about json?

no
class
more

【在 m******o 的大作中提到】
: Working on converting a rmi call to web service. The converting itself is no
: big deal until I found out the returned value is a HashMap that has 7
: ArrayLists. Each of these ArrayList has multiple 'regular' objects (A class
: that describes a working shift), and each of these objects contains two more
: ArrayLists, one contains classes that describe each segment of this shift
: and the other describes related breaks and lunches, etc.
: I plan to go the dumb way to convert this stupid thing to a big Strin

avatar
t*e
9
I had one JAX-WS enabled Spring bean. One interface method returns Map, and
it works just fine. The JAX-WS runtime is Metro though.
avatar
m*t
10

I was going to suggest this too. There's nothing wrong with serializing
the whole thing into a big string, just don't do it yourself. :)

【在 Q**g 的大作中提到】
: how about json?
:
: no
: class
: more

avatar
m*o
11
Unfortunately I'm not sure I can get it done in time using any of the smart
ways so I played safe and did the serialization myself and just finished it
today. Got a few other things to take care of, will go back and try the
better ways after that.
Thanks for all inputs.

【在 m******t 的大作中提到】
:
: I was going to suggest this too. There's nothing wrong with serializing
: the whole thing into a big string, just don't do it yourself. :)

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。