public Object invokeMethod(String methodName, Object[] args, Type retType) throws ServiceInvocationException {
    """
	Invokes a remote service providing the name of the method to invoke name
	and the list of parameters. The invocation is a blocking network request
	and thus should not be performed on the main thread.
	
	@param methodName
	- the name of the method to invoke.
	@param args
	- the array of the parameters to pass to the method.
	@return the return value of the method, if any, or null if the method
	returns void.
	@throws ServiceInvocationException
	if an invocation is thrown during the execution of the
	service.
    """
		checkCurrentThread(methodName);
		Utils.notNull(methodName);
		Utils.notNull(args);

		// Let the target prepare the arguments if needed
		mInvocationTarget.prepareArguments(args);

		// Serialize arguments
		String payload = GsonHelper.gson.toJson(args);
		InvocationRequest request = new InvocationRequest(mServiceDescriptor.getAppIdentifier(), mServiceDescriptor.getServiceName(), methodName, payload);

		// Let the target perform the execution
		InvocationResponse response = mInvocationTarget.executeService(request);

		// Analyze the response
		if (!response.isResult()) {
			throw new ServiceInvocationException(response.getErrorMessage());
		} else if (retType.equals(void.class)) {
			return null;
		} else {
			return GsonHelper.gson.fromJson(response.getPayload(), retType);
		}
	}
public Object invokeMethod(String methodName, Object[] args, Type retType) throws ServiceInvocationException {
		checkCurrentThread(methodName);
		Utils.notNull(methodName);
		Utils.notNull(args);

		// Let the target prepare the arguments if needed
		mInvocationTarget.prepareArguments(args);

		// Serialize arguments
		String payload = GsonHelper.gson.toJson(args);
		InvocationRequest request = new InvocationRequest(mServiceDescriptor.getAppIdentifier(), mServiceDescriptor.getServiceName(), methodName, payload);

		// Let the target perform the execution
		InvocationResponse response = mInvocationTarget.executeService(request);

		// Analyze the response
		if (!response.isResult()) {
			throw new ServiceInvocationException(response.getErrorMessage());
		} else if (retType.equals(void.class)) {
			return null;
		} else {
			return GsonHelper.gson.fromJson(response.getPayload(), retType);
		}
	}
public Object invokeMethod ( String methodName , Object [ ] args , Type retType ) throws ServiceInvocationException { checkCurrentThread ( methodName ) ; Utils . notNull ( methodName ) ; Utils . notNull ( args ) ; // Let the target prepare the arguments if needed mInvocationTarget . prepareArguments ( args ) ; // Serialize arguments String payload = GsonHelper . gson . toJson ( args ) ; InvocationRequest request = new InvocationRequest ( mServiceDescriptor . getAppIdentifier ( ) , mServiceDescriptor . getServiceName ( ) , methodName , payload ) ; // Let the target perform the execution InvocationResponse response = mInvocationTarget . executeService ( request ) ; // Analyze the response if ( ! response . isResult ( ) ) { throw new ServiceInvocationException ( response . getErrorMessage ( ) ) ; } else if ( retType . equals ( void . class ) ) { return null ; } else { return GsonHelper . gson . fromJson ( response . getPayload ( ) , retType ) ; } }
Invokes a remote service providing the name of the method to invoke name
and the list of parameters. The invocation is a blocking network request
and thus should not be performed on the main thread.

@param methodName
- the name of the method to invoke.
@param args
- the array of the parameters to pass to the method.
@return the return value of the method, if any, or null if the method
returns void.
@throws ServiceInvocationException
if an invocation is thrown during the execution of the
service.
Invokes a remote service providing the name of the method to invoke name and the list of parameters . The invocation is a blocking network request and thus should not be performed on the main thread .