public class ServiceCaller
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
class |
ServiceCaller.ServiceException |
| Constructor and Description |
|---|
ServiceCaller(java.net.URL wmServer) |
| Modifier and Type | Method and Description |
|---|---|
<M extends Service.Message> |
callService(java.lang.String serviceName,
java.lang.Class<M> messageClass,
java.util.HashMap<java.lang.String,java.lang.String> params)
Calls the given service with the given parameters, and retrieves the response, parsed into a convenient Java object.
|
public ServiceCaller(java.net.URL wmServer)
wmServer - the URL of the wikipedia miner server to call.public <M extends Service.Message> M callService(java.lang.String serviceName, java.lang.Class<M> messageClass, java.util.HashMap<java.lang.String,java.lang.String> params) throws java.io.IOException, ServiceCaller.ServiceException
M - The type of message expected from the given serviceserviceName - The name of the service to callmessageClass - The expected class of message this service returnsparams - Your query parameters. Note that 'responseFormat' will be ignored.java.io.IOException - If there was a problem communicating with the Wikipedia Miner serverServiceCaller.ServiceException - If there was a problem processing your request (missing parameters, invalid ids, etc)Copyright © 2012 David Milne. All Rights Reserved.