• Post Reply Bookmark Topic Watch Topic
  • New Topic

SOAP Document being truncated by Web Service

 
chris gar
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using Apache Axis in this scenario. I am returning an XML(SOAP) document from my web service and it is getting truncated. The file is about 1 megabyte in size (1164 kb).
Troubleshooting: I doubled the size of the file (copy/paste) and it still truncates but not at the same place. Then I tried a different document entirely (which was approximately 1/3 the size of the initial document) and it too gets truncated.
There doesn't seem to be any rhyme or reason for this truncation, but each individual document is truncated in the same place each time. i.e. the first attempt (the 1164kb file) returns a file that is 1152kb - always.
The second file (the first one doubled - 2328kb) returns a file 2315kb. In the third example, the orig file is 582kb, the file returned is 568kb.
Any clues???
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like it's just losing the last chunk of every transmission. Do you flush() the sending stream?
 
chris gar
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your input, Stan.
Here is the server-side code. My understanding is that the "Axis" product is doing the flushing, etc. under the covers. We want to use Axis to prevent all the manual manipulation/preparation of large xml documents.

package xxxxxxxxxx
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.apache.axis.message.SOAPBodyElement;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

public class XXXXXXXXXXX {


public Element[] doXXXXXXXX(Element[] elem) throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();

System.err.println("parsing file");
Document document = builder.parse( "c:/temp/testHydro.xml" );
System.err.println("parsing complete");
Element elDoc = document.getDocumentElement();
Element[] elarray = new Element[1];
elarray[0]=elDoc;
return elarray;
}
}
This is only for a demo we are preparing. It doesn't do anything with the "element" it receives as an argument. The code simply(attempts to )return an xml doc from c:/temp.
We have isolated (sniffed) the problem to the server side.
This may very well be a problem with Axis. I searched their bug list and didn't find anyting. It would seem that data truncation would be a pretty serious problem though - I would think someone (other than me - the novice) would have come accross that by now.
Thanks again for your help and quick response.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to save Kyle the trouble...
Chris, your name does not conform to the 'ranch laws. You have to use your first name AND surname.
 
chris gar
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok
 
wei ma
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could it be the white spaces got truncted ? Maybe you should print out the retuning document to see the difference.
 
chris gar
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by wei ma:
Could it be the white spaces got truncted ? Maybe you should print out the retuning document to see the difference.

No it truncates at a specific point. The white spaces are intact. It just stops at some point. Generally the document returned is 97 - 99 % of the document expected. One coleague has suggested a method within Axis that is incorrectly estimating the size of the document. Another has mentioned that it may be related to a stream not being flushed. ?!?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!