Jiří Pejchal
unread,Jun 24, 2012, 8:21:36 AM6/24/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to json...@googlegroups.com
What is the correct way of configuring CompositeJsonServiceExporter with spring?
It seems to me that @JsonRpcParam annotations are not found.
Request:
{"jsonrpc":"2.0", "id":"10", "method":"getProduct", "params":{"id" :"1"}}
Gives:
{"jsonrpc":"2.0","id":"10","error":{"code":-32602,"message":"Invalid method parameters"}}
<bean id="productService" class="cz.service.impl.ProductServiceImpl" />
<bean id="categoryService" class="cz.service.impl.CategoryServiceImpl"/>
<bean name="export" class="com.googlecode.jsonrpc4j.spring.CompositeJsonServiceExporter">
<property name="services">
<list>
<ref bean="productService"/>
<ref bean="categoryService"/>
</list>
</property>
<property name="serviceInterfaces">
<list>
<value>cz.service.ProductService</value>
<value>cz.service.CategoryService</value>
</list>
</property>
</bean>
public interface ProductService {
ProductDTO getProduct(@JsonRpcParam("id") String id);
}
public class ProductServiceImpl implements ProductService {
@Override
public ProductDTO getProduct(String id) {
return new ProductDTO(id, "name");
}
}
Positional parameters works:
{"jsonrpc":"2.0", "id":"10", "method":"getProduct", "params":["1"]}
{"jsonrpc":"2.0", "id":"10", "method":"getCategory", "params":["1"]}
If I use JsonServiceExporter and just one service it works as expected:
--> {"jsonrpc":"2.0", "id":"10", "method":"getProduct", "params":{"id":"1"}}
<-- {"jsonrpc":"2.0","id":"10","result":{"id":"1","name":"name"}}
Jiří Pejchal