I'm currently using Jim Roepcke's excellent XML-RPC WO-framework for
inter-application communication. You can download the framework here:
http://jim.roepcke.com/webobjects/xmlrpc/
It's both a server and client framework and a joy to use.
Here's an example from my own little recipe website :-).
------ Server Application ------
1. Register classes that should be accessible via XML-RPC (you can do
this, for example, in your Application constructor). Here I'm
registering one called "FDXMLRPC":
public Application() {
XmlRpc.setDriver( SAXParser.class );
WOXmlRpc.addHandler( "FDXMLRPC", new FDXMLRPC() );
}
2. Implement your class as usual, returning (NS) arrays, dictionaries,
strings, numbers, data... (you can see in the XML-RPC spec which
datatypes are supported). For Example, here's the interface for
FDXMLRPC (not showing the implementation):
/**
* @return All recipes in the db, sorted by date, descending.
*/
public NSArray<NSDictionary<String, Object>> recipes() {}
/**
* @return Recipes matching searchString, sorted by name. If
searchString is empty/null, returns all recipes.
*/
public NSArray<NSDictionary<String, Object>> searchRecipes( String
searchString ) {}
------ Client Application ------
1. Make the call to your server application
/**
* Fetches all recipes
*/
public NSArray<NSDictionary<String, String>> recipes() {
String url = "http://hugi.karlmenn.is/Apps/WebObjects/Feedr.woa/wa/WOXmlRpc/RPC2
";
String method = "FDXMLRPC.recipes";
try {
XmlRpcClient client = new XmlRpcClient( url );
return (NSArray<NSDictionary<String,
String>>)client.execute( method, NSArray.emptyArray() );
}
catch( Exception e ) {
logger.error( "KMRecipes: No connection to XML-RPC: " + METHOD + "
- at - " + URL );
return NSArray.emptyArray();
}
}
And you're done. Fast, simple and effective - I love it :-).
Of course, I'm writing about someone else's framework here, perhaps
Jim himself would like to add some comments ;-).
Cheers,
- Hugi
On 4.12.2008, at 22:27, Amedeo Mantica wrote:
Hello,
I have to start a new project, help me choose the right way :-)
I need to create two distinct webobjects applications, one running
on my customer's server, and one running in the my webfarm.
There are also two distinct databases, one on customer and one on my
webfarm.
So, the each application access it's own database.
I need that the application on my webfarm get access to some data in
the customer's database, but I cannot connect directly to database,
I should ask the data to the application running on my customer.
I have never done this, I have heard about SOAP ( is right ?? ), do
you know some examples ?
I'm reading this doc...
http://developer.apple.com/documentation/WebObjects/Web_Services/Introduction/chapter_2_section_1.html
right?
Thanks in advance
Amedeo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/hugi%40karlmenn.is
This email sent to [EMAIL PROTECTED]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]