File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Web Services  Performance Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Web Services  Performance Problem" Watch "Web Services  Performance Problem" New topic
Author

Web Services Performance Problem

raja jayaraman
Greenhorn

Joined: Nov 27, 2003
Posts: 8
I am trying to use web services in our project in websphere server, In this we are using swing as client to connect the EJB, which is running thru web services. we are able to connect EJB and get the response from websphere server using web services. The below code is in EJB as business method
public Vector getData(){
Vector v = new Vector();
for(int i=0;i<20000;i++)
v.add("String");
return v;
}
I use SOAP RPC encoding and in the client side i use SOAP.jar to connect the web service and get the response.
but it takes around 8 seconds to get the response.
at the same time, i used below code in EJB as business method
public Vector getData(){
Vector v = new Vector();
for(int i=0;i<20000;i++)
v.add(new DataObject("String"));
return v;
}
public class DataObject{
String str = null;
public DataObject(String data){
str = data;
}
public String getData(){
return str;
}
public void setData(String data){
this.data = data;
}
}
here, i create object for my own DataObject class.
now i connect to this EJB, it takes double the amount of time to get the response.
Please help me, Is there any other way to increase the performance of web services?
Thanks,
Raja
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12835
    
    5
20000 objects is a LOT to encode in XML and then decode on the client side. If I had to send 20000 strings, I would send them as an attachment - thus minimizing the amount of encoding and decoding. Adding attachment specifications to SOAP was one of the key decisions that widened the acceptance of Web Service.
Bill
raja jayaraman
Greenhorn

Joined: Nov 27, 2003
Posts: 8
Hi,
Thanks for your reply.
Could you please tell me how to use Adding attachments in SOAP?
is there any website about the same, if it is, please give me the link.
Thanks,
Raja
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Read chapter 13 of the Java Web Services Tutorial.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Unfortunately, that chapter won't help him in he's in WebSphere and using SOAP.jar, which leads me to believe he's on WebSphere 4.0.x (and thus Apache SOAP). Raja, could you please tell us what version of WebSphere you're working with, and whether or not you are using WebSphere studio?
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
raja jayaraman
Greenhorn

Joined: Nov 27, 2003
Posts: 8
Kyle and Lasse,
Thanks for your reply, Kyle i am using Websphere version 5.0 and Websphere Studio5.0. Please help me, how to do the attachment in SOAP using websphere.
Thanks,
Raja.
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
OK, this article might help you out a bit -- but I'll warn you I've not tried it in the full 5.0 version.
However, my REAL recommendation is that you move PRONTO to WAS 5.02 and WSAD 5.1, which totally resolves the attachment issue by becoming JAX-RPC and SAAJ compliant (not to mention WAY faster).
Kyle
raja jayaraman
Greenhorn

Joined: Nov 27, 2003
Posts: 8
Kyle,
Thanks very much for your help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Web Services Performance Problem