Question on calling a service from RTC WebUI
Serghei Zagorinyak (48●2●9●13)
| asked Aug 07 '12, 9:08 a.m.
retagged Aug 09 '12, 10:52 a.m. by Vladimir Amelin (704●7●22●26) Hi! I'm new to Jazz and RTC and have faced a task of creating a simple plugin. I have a service plugin providing com.example.hellojazz.common.service.IHelloJazzService (took it from this tutorial) and a web page com.test.app.ui.web.ui.internal.page.pageTest from here. When I run the page with contents from the tutorial, it works fine. But when I add some code to call my service, I get Resource does not exist: com.test.app.ui.web.ui.internal.page.pageTest.js exception. The page is in the same place, of cource. Below is the code of the page, bold is the one I added (from here, listing 6-8). I'll be grateful for any help on this problem. -------------------
dojo.provide("com.test.app.ui.web.ui.internal.page.pageTest");
|
Accepted answer
The Hello Jazz tutorial illustrates the implementation of an RPC-style service, which can only be invoked by Java clients, not Javascript clients. A service that can be invoked by Javascript clients is known as a "modelled REST" service, and the mechanism is described in https://jazz.net/wiki/bin/view/Main/JazzAjaxTransportDesign.
To convert the Hello Jazz service to be a modelled REST service, I think you'll need to do this:
Serghei Zagorinyak selected this answer as the correct answer
Comments
Serghei Zagorinyak
commented Aug 08 '12, 2:39 a.m.
Thanks a lot. Now the thing seems to work fine! =) Still have to deal with a lot of JS code, so more questions coming. |
2 other answers
I've altered the service invocation code to look like this: var self= this;var handlerObject= { success: function(resultList) { self._displayResults(resultList); }, failure: function(errorObj) { self.handleError(errorObj,"Error getting remote data."); } }; var responseHandler= new ServiceResponseHandler(handlerObject, "success", "failure"); var reqParms= { }; var serviceRequest = new ServiceRequest("com.example.hellojazz.common.service.IHelloJazzService", "sayHello",reqParms ); var cback = TeamServerClient.invokeService(serviceRequest, srh); Now the page loads, but I get a JavaScript error: TypeError: _13.match(_14) is null which comes from
com.ibm.team.repository.web.transport.ServiceRequest._validateMethod=function(_13){ if(!dojo.isString(_13)){ return false; } var _14=/^(get|post)/; var _15=_13.match(_14)[0]; return _15!==null; }; and actually says nothing to me except that something is wrong with my service request. |
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.