aspose file tools*
The moose likes Web Services and the fly likes Webservice Slow Returning Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Webservice Slow Returning" Watch "Webservice Slow Returning" New topic
Author

Webservice Slow Returning

Andy Holm
Ranch Hand

Joined: Jul 03, 2008
Posts: 86
I have a web service written in Java that is slow in returning. When I say it is slow, I mean the work of the business logic is done within a few seconds but a response isn't returned to my caller for 20-30 minutes. It is much quicker when I run on a local server as opposed to a remote server. The web service runs on Tomcat 6 with Axis 2. My web service returns an array of Term objects that I created. Here is a snippet of XML that is returned...

Andy Holm
Ranch Hand

Joined: Jul 03, 2008
Posts: 86
This appears to be somewhat related to the Term object. When I return a String the response is much quicker. Also, when I return just one Term object, it takes longer than it should (30 seconds) but it is faster than when an array of these objects are created and returned. Any ideas on what might be wrong or how to debug?

Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
I would use some kind of profiling software, for instance VisualVM (free and bundled with JDK 6), YourKit (rather expensive, but there is a trial license available) or TPTP (test and performance tools for Eclipse, if you are using Eclipse) also free. Alternatively I would also consider AOP.
Then profile the server when it only runs the web service that is slow, examining where it spends most of the time.
This will hopefully give you some clues to where the problem is.
Best wishes!
Andy Holm
Ranch Hand

Joined: Jul 03, 2008
Posts: 86
Based on the debugging I have already done, I am certain the slowness has to do with the return value of a complex data type. The problem is not present when I return an array of Strings rather than my array of custom objects. I have not done anything special to handle the complex data type. Since this is my first time returning a complex data type from a web service, is there anything special that needs to be done? Also, I noticed that when I ask the service to create its WSDL via my web browser, it takes a bit of time to generate the WSDL. Could that be related? I did not supply a WSDL in my service archive.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Interesting problem, I'll give it a try, that is, write a simple web service that returns one of your custom objects.
However, first I need to ask what kind of data binding you are using (since I've heard Axis2 supports a number of different data bindings)?

Update:
Had a chance to, using the Eclipse WS wizard, generate a service that returns either one Term object or an array of Term objects.
Tested both the SOAP 1.1 and SOAP 1.2 binding using soapUI and they both return an array of 500 Term objects in a blink of an eye.
The HTTP binding seems a little more unreliable. First of all, I cannot test it from soapUI, so I used the Eclipse web service explorer to test it. Don't know if it is a problem with the web service explorer or the web service, but I cannot seem to retrieve an array of Term objects with this binding.
Best wishes!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Webservice Slow Returning