Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Design question about WebServices.

 
Claude Moore
Ranch Hand
Posts: 832
7
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good evening,

I'm asking your help to set up my mind on usage of WebServices. I have a swing client which executes calls on a remote appserver, using HttpClient. The whole data I need to pass is encoded in a Base64 string and I call the remote service. Data passed are regular Java Classes, available both at server and client side in a Jar file: actual java instances are serialized in a ByteArrayStream and "coverted" in a Base64 string from there.

I used to use this schema but I began to feel that is quite "self-made" and it's not at all a used practice elsewhere... moreover, my handcraft communication protocol could never be integrated in a SOA usage. So, I thought to remake the class responsible to execute calls using Jax-WS. I read about MTOM to exchange large binary files, and I thought to use MTOM and DataHandler to pass serialized data. The whole thing works, but, quite unexpectedly, I measured an increased overhead on using it. The very same call, on a local configuration (in which both server and client run on the same machine) , with JAX-WS takes twice the time it used to require in "HttpClient" mode.

I'm wondering if I'm totally on a wrong way,and if I should use MTOM only for exchange binary files (like PDF, XLS or others) and not as a mean to enhance remote calls....

Moreover... I'm really in doubt if usage of webservices may be a viable approach, when I need to execute remote calls many times.

Could anybody advice me ?
Thanks in advance.



 
Roger Sterling
Ranch Hand
Posts: 426
Eclipse IDE Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are correct in your assessment. HttpClient-style bulk transmission is more efficient than Web Service MTOM. The reason is, there is some marshaling required for WS. What then are the advantages of constructing your program as a Web Service? Primarily, it is inter-operability and reuse. Where more than one request is present, create your Web Service as a multi-threaded server. The increase in overhead is thus covered up by the multiple instances. Ideally, run both styles. Set your HttpClient port one value, and the WS port another value. The implementations are not mutually exclusive.
 
Claude Moore
Ranch Hand
Posts: 832
7
IBM DB2 Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lance,

thank you for your reply. I've the feeling that the problem with webservices is inherent within the technology itself: I mean that webservices seem to me to be "naturally" slower than other approaches. I was personally never able to build a webservices (JAX-WS, JAX-RPC) which was faster than HTTP Call. The problem is that over WAN HttpCall aren't very effective; and I can't understand why a web browser goes significantly faster than an HttpConnection when transmits the same information content. Anyway, I think that the problem of making RPC calls over the internet is a very common problem: what would be the best way, in your opinion, to execute RPCs ?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!