资 源 简 介
Java 5 Client Framework for Fairly Arbitrarily Defined Web Services
Framework for creating Java 5 clients for web services that use common designs with more or less strict definitions - such as XML over HTTP, JSON RPC etc.
The framework uses a "declarative" style with the syntaxical advantages Java 5 gives.
This example creates a client object for Google"s translation service:
```
// Service definition:
public interface GoogleTranslate {
@FadService(
requestUrl = "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&langpair={0}&q={1}",
responseEncoding = FadService.ResponseEncoding.JSON,
responseSubhierarchy = "responseData.translatedText"
)
public String translate(String languagePair, String text);
}
// Usage:
GoogleTranslate googleTranslate = FadClient.create(GoogleTranslate.class);
System.out.println("What does "rød grød med fløde" mean?");
System.out.