It's all about the answers!

Ask a question

how to send Map object by using client library


Ken Kumagai (64) | asked Apr 06 '09, 11:08 a.m.
Hi

I'm trying to extend "HelloJazz"

https://jazz.net/learn/LearnItem.jsp?href=content/docs/hello-jazz/index.html

to be able to send Map<String, Object> object as well as String.
(">" is expressed to ">" in following sentences)

To achieve this, I added interface and impl to each package as follows.

- common package

Map<String, Object> sendMap(Map<String, Object> map) throws TeamRepositoryException;

- client package
Map<String, Object> sendMap(Map<String, Object> map) throws TeamRepositoryException;

- client internal package
public Map<String, Object> sendMap(Map<String, Object> map) throws TeamRepositoryException{
Map<String, Object> newMap = getService().sendMap(map);
return newMap;
}

- service package
public Map<String, Object> sendMap(Map<String, Object> map) throws TeamRepositoryException{
Iterator<String> iter = map.keySet().iterator();
while(iter.hasNext()){
String key = iter.next();
String value = (String)map.get(key);
System.out.println("key:" + key+ ",value:" + value);
}
return map;
}

however I met this error by running these code...

com.ibm.team.repository.common.transport.ServiceMethodInvocationError: java.lang.ClassCastException: java.util.HashMap incompatible with org.eclipse.emf.ecore.EObject
at com.ibm.team.repository.transport.client.RemoteTeamService.getAppropriateException(RemoteTeamService.java:571)
at com.ibm.team.repository.transport.client.RemoteTeamService.executeMethod(RemoteTeamService.java:474)
at com.ibm.team.repository.transport.client.RemoteTeamService.invoke(RemoteTeamService.java:184)
at com.ibm.team.repository.transport.client.ServiceInvocationHandler.invoke(ServiceInvocationHandler.java:43)
...

This means complicated object(such as Map) cannot be sended in raw condition from client library to server side,
and some marshal steps are needed ?

If so, do we have to write marshaling methods by myself or some methods are prepared for this purpose ?

These 2 are my questions.

Thanks

Ken

Be the first one to answer this question!


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.