开发者

JNDI In .Net / PHP / IPhone

开发者 https://www.devze.com 2023-03-25 17:18 出处:网络
Let me exaplain you the complete situation currently I am stuck with in. We are developi开发者_如何学Gong very much complex application in GWT and Hibernate, we are trying to host client and server

Let me exaplain you the complete situation currently I am stuck with in.

We are developi开发者_如何学Gong very much complex application in GWT and Hibernate, we are trying to host client and server code on different servers because of client's requirement. Now, I am able to achieve so using JNDI.

Here comes the tricky part, client need to have that application on different Platform also, database would be same and methods would be the same, lets say iPhone / .Net version of our application. we don't want to generate Server code again because it's gonna be the same for all.

I have tried for WebServices wrapper on the top of my server code but because of complexity of architecture and Classes dependencies I am not able to do so. For example, Lets consider below code.

    class Document {
        List<User>;
        List<AccessLevels>;
     }

Document class have list of users, list of accesslevels and lot more list of other classes and that other classes have more lists. Some important server methods takes Class (Document or any other) as input and return some other class in output. And we shouldn't use complex architecture in WebServices.

So, I need to stick with JNDI. Now, I don't know how can I access JNDI call to any other application ???

Please suggest ways to overcome this situation. I am open for technology changes that means JNDI / WebServices or any other technology that servers me well.

Thanking You,

Regards,


I have never seen JNDI used as a mechanism for request/response inter-process communication. I don't believe that this will be a productive line of attack.

You believe that Web Services are inappropriate when the payloads are complex. I disagree, I have seen many successful projects using quite large payloads, with many nested classes. Trivial example: Customers with Orders with Order Lines with Products with ... and so on.

It is clearly desirable to keep payload sizes small, there are serialization and network costs, big objects will be more expensive. But it's by far preferable to have one big request than lot's of little one. A "busy" interface will not perform well across a network.

I suspect that the one problem you may have is that certain of the server-side classes are not pure data, they refer to classes that only make sense on the server, you don't want those classes in you client.

I this case you need to build an "adapter" layer. This is dull work, but no matter what Inter-process communication technique you use you will need to do it. You need what I refer to as Data Transfer Objects (DTOs) - these represent payloads that are understood in client, using only classes reasonable for the client, and which the server can consume and create.

Lets suppose that you use technology XXX (JNDI, Web Service, direct socket call, JMS)

  Client --- sends Document DTO --XXX---> Adapter transform DTO to server's Document

and similarly in reverse. My claim is that no matter what XXX is chosen you have the same problem, you need the client to work with "cut-down" objects that reveal none of the server's implementation details.

The adapter has responsibility for creating and understanding DTOs.

I find that working with RESTful Web Services using JAX/RS is very easy once you have a set of DTOs it's the work of minutes to create Web Services.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号