Error message

There is no Taobao Open Platform (TOP) transformer for Service:[${serviceUniqueName}].

Solution

When the TOP call is transformed on the provider, the corresponding transformer is not found. During provider initialization, call com.taobao.hsf.ServiceInvokeTransform.Helper#register to register a transformer.

TOP call methods

The TOP call method prevents the gateway application from depending on the API package of the backend service.

Client

The client uses com.taobao.hsf.app.spring.util.SuperHSFSpringConsumerBeanTop.This class does not need the API package of the server.

It calls the API through com.taobao.hsf.app.spring.util.SuperHSFSpringConsumerBeanTop#invoke.

/**
 * TOP calls this method to access the HSF service remotely.
 * <p>
 * The parameterTypes parameter indicates the type of the parameter of the method to be called. It must be a complete Java class name. If the parameter is an atomic type, the type is the name of the atomic type.
 * </p>
 * 
 * @return Returns the peer service response or service error.
 * 
 * @throws HSFException
 *             If an error occurs at the local or peer HSF layer, HSFException is thrown.
 * @throws Throwable
 * If an error occurs on the server, Exception is thrown.
 */
public Object invoke(String methodName, String[] parameterTypes, Object[] args) throws HSFException, Throwable {
    return consumerBeanTop.invoke(methodName, parameterTypes, args);
}
			

Here args is not the actual service type of the server.

Server

When the server is initialized, com.taobao.hsf.ServiceInvokeTransform.Helper#register is called to register a transformer.

/**
 * It is used to convert the service call parameters into a format that is acceptable to the service.
 * 
 * @param methodName
 *            The name of the service method to be called.
 * @param args
 *            The call parameter before conversion.
 * @param parameterTypes
 *            The real parameter type of the service method to be called.
 */
abstract public Object[] transformRequest(String methodName, Object[] args, String[] parameterTypes)
        throws Exception;

/**
 * The type of the request parameter to be converted.
 * 
 * @param methodName
 * @param args
 * @param parameterTypes
 * @return
 * @throws Exception
 */
abstract public String[] transformRequestTypes(String methodName, Object[] args, String[] parameterTypes)
        throws Exception;
			

The transformer converts parameters transmitted by the client into real service types on the server. HSF calls the service based on converted parameters and then uses the transformer to convert the service result and then return the result to the TOP client.