00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "vostut7hello.hh"
00012
00013 int main(int argc, char** argv)
00014 {
00015 Hello::registerExtenders();
00016
00017 LocalSocketSite site(&NoAccessControl::static_);
00018
00019 try {
00020
00021 string siteurl;
00022 if(argc > 1) siteurl = argv[1];
00023 else siteurl = "vop://localhost:4231";
00024
00025 LOG("helloclient", 1, "Acquiring remote object at " << siteurl);
00026
00027 vRef<Vobject> v = Vobject::findObjectFromRoot(siteurl + "/hello");
00028
00029 Hello& h = MetaObject::meta_cast<Hello&>(*v);
00030
00031 LOG("helloclient", 1, "Saying 'Good day to you sir.'");
00032
00033
00034
00035
00036
00037 string s = h.hello("Good day to you sir.");
00038
00039 LOG("helloclient", 1, "Got back: '" << s << "'");
00040
00041 } catch(Vobject::NoSuchObjectError x){
00042 LOG("helloclient", 1, "NoSuchObjectError " << x.what());
00043 } catch(Vobject::NoSuchSiteError x){
00044 LOG("helloclient", 1, "NoSuchSiteError " << x.what());
00045 } catch(Vobject::AccessControlError x){
00046 LOG("helloclient", 1, "AccessControlError " << x.what());
00047 } catch(Vobject::RemoteError x){
00048 LOG("helloclient", 1, "RemoteError " << x.what());
00049 } catch(URL::BadURLError x){
00050 LOG("helloclient", 1, "BadURLError " << x.what());
00051 } catch(bad_cast){
00052 LOG("helloclient", 1, "Bad cast");
00053 }
00054 return 0;
00055 }
00056