Amila,

Pardon me if I have got the facts wrong, but as Deepal pointed out, this
seems like a spin off from POJO support.

>How to support this with POJO?

>List getObject(List param1){
>       return param1;
>}

So  can't we improve existing POJO support ? Is there some reason or
difficulty in doing so?
I don't see much value in building overlapping features. It's better to
improve the existing one or replace the existing one with a new feature.
Overlapping features are confusing to end users.

Also I found the name RMI confusing and misleading.
Initially I thought this was a way of exposing an existing RMI Service as a
Web Service. - thats the impression I got by reading the title)
In the java space RMI is reserved for java rmi stuff and users might find
this name confusing.

just my 2 cents.

Regards,

Rajith

On 8/15/07, Amila Suriarachchi <[EMAIL PROTECTED]> wrote:
>
> hi all,
>
> I added the following features to the Axis2 rmi.
>
> 1. client proxy support instead of code generation.
>
> with this feature users can invoke a axi2 rmi service as just calling to a
> java class.
> e.g . if there is  a service interface like this
>
> public interface Service1Interface {
>
>     public String method1(String param1);
> }
>
> The service can be invoked from the client like this.(please see the
> sample for more information)
>
>       try {
>             Service1Interface proxy = (Service1Interface)
> RMIClientProxy.createProxy(Service1Interface.class,
>                     "http://localhost:8085/axis2/services/Service1 ");
>             String result = proxy.method1("Hellow world");
>
>         } catch (AxisFault axisFault) {
>             axisFault.printStackTrace();
>         }
> So it is just like writing java code once the interface proxy is created.
>
> 2. Map, HashMap, Hashtable support.
>      with this support people can invoke services which has hashMaps and
> tables.
> eg.
> public Map method(Map param1);
>
> 3. support to use a custom simple Type Handler.
> simple data types are handled by SimpleTypeHandler in Axis2-rmi. So if a
> user needs to change the way it handles the simple types, a customclass can
> be used.
>
> e.g Lets say some one needs to change the way Axis2 rmi handles the date.
> Then he can write a new class by extending the existing one and declare it
> in config.xml
>
> public class CustomSimpleTypeHandler extends SimpleTypeHandler {
>     public String convertToString(Date value) {
>         System.out.println("Converting date ==> " + value);
>         SimpleDateFormat simpleDateFormat = new
> SimpleDateFormat("yyyy-MM-ddZ");
>         return simpleDateFormat.format(value);
>     }
> }
>
> then declare this in the config.xml
>
> <config xmlns="http://ws.apache.org/axis2/rmi";>
>     <extensionClasses>
>
>     </extensionClasses>
>     <packageToNamespaceMapings>
>
>     </packageToNamespaceMapings>
>     <services>
>
>     </services>
>     <simpleDataHandlerClass>
> sample.rmi.server.databind.CustomSimpleTypeHandler
> </simpleDataHandlerClass>
> </config>
>
>
>
>
>
>
>
> On 8/14/07, Amila Suriarachchi <[EMAIL PROTECTED]> wrote:
> >
> > hi,
> > Thanks for replying, Please see my comments.
> >
> > On 8/13/07, Deepal jayasinghe < [EMAIL PROTECTED]> wrote:
> > >
> > > Hi Amila,
> > > Please see my comment below,
> > > >
> > > > hi all,
> > > >
> > > > The main objective of this module is to let users to publish their
> > > > existing Java classes as web services and access them with out
> > > warring
> > > > about Axis2 and web services.
> > > >
> > > We already have this feature , with our POJO approach one can easily
> > > convert java class into a Web service. Not only that in a single line
> > > (s)he can deploy and start up Axis2.
> >
> >
> >
> > I think I have  explain this in the Architecture and performance part of
> > my earlier mail.
> > 1. POJO is written on top of OM. So always we have to create an OM
> > Structure for request and response. This is a performance over head as I
> > saw. But Axis2-rmi directly creates the object structure from the xml stream
> > reader and writes it back to xmlstreamwritter. (But anyway this is a
> > theoratical argument and we have to do a proper performance test and see)
> >
> > 2. Lets say we have service class method like this,
> > Object getObject(Object param1){
> >        return param1;
> > }
> >
> > the idea here is user has to invoke this with any type(using the
> > RMIClient or ADB client) e.g string,Integer,Double or their custom
> > class.
> >
> > if they use a custom class the only thing we have to do is to declare
> > that is as an extension class in config.xml.
> >
> > How to support this with POJO?
> >
> > List getObject(List param1){
> >        return param1;
> > }
> >
> > user wants to invoke this method with a list of
> > String, integer, and a custom type. and returns the list. How can we do
> > this with POJO?
> >
> > the idea of Axis2-rmi is to enhance the java support to users. So that
> > they can do any thing with it.
> >
> >
> > >
> > > > This module let users to publish web services and access them some
> > > > what similar way as Java RMI does.
> > > >
> > > > Axis2-rmi uses a custom deployer and a custom archive file format to
> > > > deploy java classes. The archive file which has the .rsa (rmi
> > > service
> > > > archive) extension has the following structure.
> > > >
> > > Why do we need another file extension , can't we use .aar instead of
> > > .rsa. Not only that rsa is a encryption mechanism as well :)
> >
> >
> > Two archive files have different formats. So I would prefer a different
> > extension.
> > But I agree with you that if .rsa is already in use we have to use
> > another.
> >
> > >
> > > > META-INF
> > > >
> > > >           config.xml
> > > >
> > > > <java classes>
> > > >
> > > > For the moment there is a config.xml file under the META-INF folder
> > > > and java classes at the top folder.
> > > >
> > > Same thing , why cant we use services.xml ?
> >
> >
> > I come up with a new file since I want to add many parameters (as only
> > required by Axis2-rmi with future enhansments) to this config file with out
> > doing any changes to the Axis2-kernal.
> >
> > Axis2 -rmi is a pure plug to Axis2(it has not touch a single line of
> > code in kernal). (My thank should go to deepal to develop custom deployer
> > support). So I would like to keep that as it is since this enable it to add
> > any new feature without changing the line of code in kernal.
> >
> > The other thing I see with the service.xml it contains some parameters
> > like MessageReceiver and Mep.
> > These are not clear to a person who no experience with the Axis and web
> > services. So I wanted hide these terms and give an much sensible file which
> > only has understandable parameters with their requriements.
> >
> >
> > That has exactly the same structure .
> > > >
> > > > Later this can be improved to put jar files to a lib folder as well.
> > >
> > > > The config.xml file is used to specify the service classes and other
> > > > configuration details to the deployer. It has the following
> > > structure.
> > > >
> > > > <config xmlns=" http://ws.apache.org/axis2/rmi";>
> > > >
> > > > <extensionClasses>
> > > >
> > > > <extensionClass>sample.rmi.server.dto.ChildClass</extensionClass>
> > > >
> > > > </extensionClasses>
> > > >
> > > > <packageToNamespaceMapings>
> > > >
> > > > <packageToNamespaceMap>
> > > >
> > > > <namespace> http://sample/service</namespace>
> > > >
> > > > <packageName> sample.rmi.server</packageName>
> > > >
> > > > </packageToNamespaceMap>
> > > >
> > > > </packageToNamespaceMapings>
> > > >
> > > > <services>
> > > >
> > > > <service>
> > > >
> > > > <serviceClass> sample.rmi.server.Service1</serviceClass>
> > > >
> > > > </service>
> > > >
> > > > </services>
> > > >
> > > > </config>
> > > >
> > > > As you can see config.xml is used to specify any configuration
> > > details
> > > > like extention classes, package to namespace mappings and services.
> > > >
> > > > Now lets see a step by step example to understand how to use
> > > Axis2-rmi
> > > > to deploy a java service and access them from the client.
> > > >
> > > > Step 1 deploy the service
> > > >
> > > > In java RMI the first step in writing a distributed system is to
> > > write
> > > > the service and register it. Similarly here also we have to first
> > > > create the service and deploy it using the above file format.
> > > >
> > > > For a example if we want to deploy the following java service.
> > > >
> > > > package sample.rmi.server;
> > > >
> > > > public class Service1 {
> > > >
> > > > public Object method1(Object param1){
> > > >
> > > > return param1;
> > > >
> > > > }
> > > >
> > > > }
> > > >
> > > > Here the both input and output parameters are object type. The idea
> > > > here is to publish this web service and invoke it by sending an
> > > input
> > > > parameter actually in TestClass1 type.
> > > >
> > > > package sample.rmi.server;
> > > >
> > > > public class TestClass1 {
> > > >
> > > > private String param1;
> > > >
> > > > private String parma2;
> > > >
> > > >
> > > > public String getParam1() {
> > > >
> > > > return param1;
> > > >
> > > > }
> > > >
> > > > public void setParam1(String param1) {
> > > >
> > > > this.param1 = param1;
> > > >
> > > > }
> > > >
> > > > public String getParma2() {
> > > >
> > > > return parma2;
> > > >
> > > > }
> > > >
> > > > public void setParma2(String parma2) {
> > > >
> > > > this.parma2 = parma2;
> > > >
> > > > }
> > > >
> > > > }
> > > >
> > > >
> > > > To deploy this service one can use the following config.xml. This is
> > > > self explainable.( please change any as necessary). To find a
> > > correct
> > > > working sample please see the rmi sample under samples folder.
> > > >
> > > >
> > > > <config xmlns=" http://ws.apache.org/axis2/rmi";>
> > > >
> > > > <extensionClasses>
> > > >
> > > > <extensionClass>sample.rmi.server .TestClass1</extensionClass>
> > > >
> > > > </extensionClasses>
> > > >
> > > > <packageToNamespaceMapings>
> > > >
> > > > <packageToNamespaceMap>
> > > >
> > > > <namespace> http://sample/service</namespace>
> > > >
> > > > <packageName> sample.rmi.server</packageName>
> > > >
> > > > </packageToNamespaceMap>
> > > >
> > > > </packageToNamespaceMapings>
> > > >
> > > > <services>
> > > >
> > > > <service>
> > > >
> > > > <serviceClass> sample.rmi.server.Service1</serviceClass>
> > > >
> > > > </service>
> > > >
> > > > </services>
> > > >
> > > > </config>
> > > >
> > > Amila , sometime you might not aware that services.xml is also has the
> > >
> > > ability to map package name to namespace , so let's use that.
> >
> >
> > Please see the above comment.
> >
> > >
> > > >
> > > > The .rsa file should look like this
> > > >
> > > > META-INF
> > > >
> > > >         config.xml
> > > >
> > > > sample.rmi.server.Service1.class
> > > >
> > > > sample.rmi.server .TestClass1.class
> > > >
> > > >
> > > > There is a Custom deployer declaration in the Axis2.xml file for
> > > this.
> > > >
> > > > <deployer extension=".rsa" directory="rmiservices"
> > > > class="org.apache.axis2.rmi.deploy.RMIServiceDeployer "/>
> > > >
> > > >
> > > > So you have to put the above created archive file to rmiservices
> > > > folder under repository. (if there is no folder please create one.)
> > > > Then the Axis2 server can be started as usual and This service wsdl
> > > > can be seen.
> > > >
> > > >
> > > > Step 2 access the client.
> > > >
> > > > In Java RMI we create an Stub file to access the service. Here also
> > > it
> > > > can be given a Stub generation tool to generate the stub for the
> > > > service interface. But for the moment this feature is not there and
> > > > RMIClient can be used directly access the service.
> > > >
> > > >
> > > > public class TestService1 {
> > > >
> > > >
> > > > private Configurator configurator;
> > > >
> > > >
> > > > public TestService1() {
> > > >
> > > >
> > > > this.configurator = new Configurator();
> > > >
> > > > this.configurator.addPackageToNamespaceMaping("sample.rmi.server",
> > > > " http://sample/service";);
> > > >
> > > > this.configurator.addExtension(TestClass1 .class);
> > > >
> > > > }
> > > >
> > > >
> > > > public void testMethod13() {
> > > >
> > > >
> > > > try {
> > > >
> > > > RMIClient rmiClient = new RMIClient( Service1.class,
> > > this.configurator,
> > > > "http://localhost:8080/axis2/services/Service1 ");
> > > >
> > > > List inputObjects = new ArrayList();
> > > >
> > > > TestClass1 testClass1 = new TestClass1();
> > > >
> > > > testClass1.setParam1("test string");
> > > >
> > > > testClass1.setParam2("test string");
> > > >
> > > > inputObjects.add(testClass1);
> > > >
> > > > TestClass1 result = (TestClass1) rmiClient.invokeMethod("method1",
> > > > inputObjects);
> > > >
> > > > System.out.println("Param 1 ==>" + result.getParam1());
> > > >
> > > > System.out.println ("Param 2 ==>" + result.getParam2());
> > > >
> > > > } catch (Exception e) {
> > > >
> > > > e.printStackTrace();
> > > >
> > > > }
> > > >
> > > > }
> > > >
> > > >
> > > oh , this is exactly what RPCServiceClient does , please have a look
> > > at
> > > that.
> >
> >
> > this is the method signature it has
> > public Object[] invokeBlocking(QName opName, Object [] args, Class []
> > returnTypes)
> >             throws AxisFault {
> >
> > 1. here you have to give the return type before invoking.  this is not
> > always possible.
> > For a service I have given above
> > Object getObject(Object param){
> >     return new TestClass();
> > }
> >
> > Service can return any thing. So we don't kown the return type before
> > invoking.
> > in RMIClient it will return the correct Object.
> >
> > 2. this method throws an AxisFault. So How it supposed to handle
> > exceptions.
> > e.g.
> > Object getObject(Object param1) throws Exception1{
> >     throw new Exception1():
> > }
> >
> > will rpcClent throws Exception1?
> > Actually I mean this feature by saying exception handling.
> >
> >
> >
> >
> > >
> > > > This client can be run putting all the jars under lib directory to
> > > > class path.
> > > >
> > > > This way people can invoke their existing java classes using Soap
> > > > protocol in a similar way with Java RMI. An advanced Axis2 user may
> > > > use the following way to deploy a java class service and start the
> > > > simple http server .
> > > >
> > > > ConfigurationContext confContext =
> > > >
> > > > ConfigurationContextFactory.createConfigurationContextFromFileSystem(
> > > >
> > > > AXIS2_REPOSITORY_LOCATION, AXIS2_CONFIG_FILE);
> > > >
> > > > // add the service
> > > >
> > > > // if you want to specify additional configuration details, the
> > > > constructor with
> > > >
> > > > // the configurater as an argumet can be used.
> > > >
> > > > ClassDeployer classDeployer = new ClassDeployer(confContext);
> > > >
> > > > classDeployer.deployClass(Service1.class);
> > > >
> > > >
> > > > SimpleHTTPServer simpleHttpServer = new
> > > SimpleHTTPServer(confContext,
> > > > 5555);
> > > >
> > > > simpleHttpServer.start();
> > > >
> > > >
> > > > Features in the Current implementation (Please see the rmi sample
> > > > under sample folder)
> > > >
> > > >   1.
> > > >
> > > >       POJO support (simple beans, arrays, composite beans, null
> > > value
> > > >       handling)
> > > >
> > > >   2.
> > > >
> > > >       Extensions and polymorphisem.
> > > >
> > > >   3.
> > > >
> > > >       Fault handling
> > > >
> > > >   4.
> > > >
> > > >       Collection class support (List, ArrayList, Set , HashSet)
> > > >
> > > >   5.
> > > >
> > > >       Package to namespace mapping
> > > >
> > > our services.xml and POJO has support for all the above.
> >
> >
> > please see this mailing thread.
> > http://marc.info/?l=axis-user&m=118667693526336&w=2
> >
> >
> > >
> > > >   1.
> > > >
> > > >
> > > >
> > > > Features plaing to implement (feel free to add to this list)
> > > >
> > > >   1.
> > > >
> > > >       Map support (Map , HashMap)
> > > >
> > > >   2.
> > > >
> > > >       MTOM support. (DataHandler class support)
> > > >
> > > >   3.
> > > >
> > > >       Dom element support
> > > >
> > > >   4.
> > > >
> > > >       Configure nillable and minOccurs attributes through config.xml
> > > >
> > > >   5.
> > > >
> > > >       Provide a codegen tool to generate the stub.
> > > >
> > > >   6.
> > > >
> > > >       Qname support.
> > > >
> > > our POJO support all the above except DOM element, and which I
> > > strongly
> > > believe something we do not need.
> >
> >
> > Please see this mail thread.
> > http://marc.info/?l=axis-user&m=118654396508555&w=2
> >
> > >
> > > >   1.
> > > >
> > > >
> > > >
> > > > Architecture and Performance.
> > > >
> > > > Axis2 rmi keeps a metadata model to keep java classes and their xml
> > > > mapping details. This meta data model is used to Generate the wsdl,
> > > to
> > > > marshall the java object structure and to unmarshall java object
> > > > structure. Hence this meta data model has provide the following
> > > > advantages.
> > > >
> > > >   1.
> > > >
> > > >       directly marshal(serialize) and unmarshal(parse) the object
> > > >       structure to the xml stream with out using and intermediate
> > > xml
> > > >       object structure.
> > > >
> > > >   2.
> > > >
> > > >       Minimize the performance over head with java reflection since
> > > it
> > > >       keeps the relavent java method in metadata structure.
> > > >
> > > >   3.
> > > >
> > > >       Enable usage of extensions and polymorphism, which requires
> > > the
> > > >       inheritance relationships at the serialization and
> > > >       deserialization time.
> > > >
> > > >
> > >
> > > Thanks
> > > Deepal
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> > --
> > Amila Suriarachchi,
> > WSO2 Inc.
>
>
>
>
> --
> Amila Suriarachchi,
> WSO2 Inc.

Reply via email to