Problem while nvoking services from browser
Can some one tell what the problem is with respect to the following code? I do not find any compilation errors but could not succeed in invoking getNewMessage() from the browser (it says internal server error). However, I could invoke the other method getAllMessages().
public Message[] getAllMessages() throws TeamRepositoryException {
IQueryService queryService = getService(IQueryService.class);
MessageQueryModel queryModel = BaseMessageQueryModel.MessageQueryModel.ROOT;
IItemQuery itemQuery = IItemQuery.FACTORY.newInstance(queryModel);
IItemQueryPage itemQueryPage = queryService.queryItems(itemQuery,
IQueryService.EMPTY_PARAMETERS, IQueryService.ITEM_QUERY_MAX_PAGE_SIZE);
IRepositoryItemService repositoryItemService = getService(IRepositoryItemService.class);
IItem[] items = repositoryItemService.fetchItems(itemQueryPage.handlesAsArray(), null);
ArrayList<Message> messages = new ArrayList<Message>();
for (IItem item : items) {
if (item instanceof Message) {
messages.add((Message) item);
}
}
return (Message[]) messages.toArray(new Message);
}
public Message getNewMessage()
throws TeamRepositoryException {
IRepositoryItemService repositoryItemService = getService(IRepositoryItemService.class);
Message message = (Message) getMessageItemType().createItem();
message.setText("hello");
message.setTest("hi");
message = (Message) repositoryItemService.saveItem(message);
return message;
}
static IItemType getMessageItemType() {
return IItemType.IRegistry.INSTANCE
.getItemType(JazztalkPackage.eINSTANCE.getMessage().getName(), JazztalkPackage.eNS_URI);
}
These are the related warnings on console. Why they are being raised for only of these methods "getNewMessage()" and not for the other?
21:59:04,687 WARN ory.servlet.internal.ModelledRestServiceMethodInfo - CRJAZ1177I Unable to find matching method for $Proxy76, GET, newmessage
22:00:52,578 WARN ory.servlet.internal.ModelledRestServiceMethodInfo - CRJAZ1177I Unable to find matching method for $Proxy76, GET, newmessage
public Message[] getAllMessages() throws TeamRepositoryException {
IQueryService queryService = getService(IQueryService.class);
MessageQueryModel queryModel = BaseMessageQueryModel.MessageQueryModel.ROOT;
IItemQuery itemQuery = IItemQuery.FACTORY.newInstance(queryModel);
IItemQueryPage itemQueryPage = queryService.queryItems(itemQuery,
IQueryService.EMPTY_PARAMETERS, IQueryService.ITEM_QUERY_MAX_PAGE_SIZE);
IRepositoryItemService repositoryItemService = getService(IRepositoryItemService.class);
IItem[] items = repositoryItemService.fetchItems(itemQueryPage.handlesAsArray(), null);
ArrayList<Message> messages = new ArrayList<Message>();
for (IItem item : items) {
if (item instanceof Message) {
messages.add((Message) item);
}
}
return (Message[]) messages.toArray(new Message);
}
public Message getNewMessage()
throws TeamRepositoryException {
IRepositoryItemService repositoryItemService = getService(IRepositoryItemService.class);
Message message = (Message) getMessageItemType().createItem();
message.setText("hello");
message.setTest("hi");
message = (Message) repositoryItemService.saveItem(message);
return message;
}
static IItemType getMessageItemType() {
return IItemType.IRegistry.INSTANCE
.getItemType(JazztalkPackage.eINSTANCE.getMessage().getName(), JazztalkPackage.eNS_URI);
}
These are the related warnings on console. Why they are being raised for only of these methods "getNewMessage()" and not for the other?
21:59:04,687 WARN ory.servlet.internal.ModelledRestServiceMethodInfo - CRJAZ1177I Unable to find matching method for $Proxy76, GET, newmessage
22:00:52,578 WARN ory.servlet.internal.ModelledRestServiceMethodInfo - CRJAZ1177I Unable to find matching method for $Proxy76, GET, newmessage
2 answers
The error message is saying it can't figure out which method you're trying to call based on the URL.
From what I've seen, to get the path you need to drop the get/post then make the first char lowercase, e.g. getNewMessage -> newMessage. I notice your error message has "newmessage" all lowercase.. try "newMessage"..
From what I've seen, to get the path you need to drop the get/post then make the first char lowercase, e.g. getNewMessage -> newMessage. I notice your error message has "newmessage" all lowercase.. try "newMessage"..