I had a similar problem and I solved the problem by modifying org.apache.axis.Message
and org.apache.axis.SoapPart
I hope it will solve your problem.
What I have done is :
modify the method writeTo in SoapPart :
/**
* Write the contents to the specified writer.
*/
public void writeTo(Writer writer) throws IOException {
if ( currentForm == FORM_FAULT ) {
AxisFault env = (AxisFault)currentMessage;
try {
env.output(new SerializationContextImpl(writer,
getMessage().getMessageContext()));
} catch (Exception e) {
log.error(Messages.getMessage("exception00"), e);
throw env;
}
return;
} else if ( currentForm == FORM_SOAPENVELOPE ) {
SOAPEnvelope env = (SOAPEnvelope)currentMessage;
try {
env.output(new SerializationContextImpl(writer,
getMessage().getMessageContext()));
} catch (Exception e) {
throw AxisFault.makeFault(e);
}
return;
} else {
writer.write(this.getAsString());
}
then in Message :
add a constant :
/**
* This is the buffer size used to output xml contents.
*/
public static int DEFAULT_OUTPUT_BUFF_SIZE = 1000000;
modify method getContentType
public String getContentType(SOAPConstants sc) throws AxisFault {
int sendType = Attachments.SEND_TYPE_NOTSET;
if ((msgContext != null) && (msgContext.getService() != null)) {
sendType = msgContext.getService().getSendType();
}
/*
if (sendType != Attachments.SEND_TYPE_NONE) {
//Force serialization if it hasn't happend it.
//Rick Rineholt fix this later.
mSOAPPart.getAsBytes();
} */
String ret = sc.getContentType();
if (mAttachments != null && 0 != mAttachments.getAttachmentCount()) {
ret = mAttachments.getContentType();
}
return ret;
}
modify method writeTo:
public void writeTo(java.io.OutputStream os) throws SOAPException, IOException {
//Do it the old fashion way.
if (mAttachments == null || 0 == mAttachments.getAttachmentCount()) {
try {
Writer writer = new OutputStreamWriter(os,"UTF-8");
// writer = new BufferedWriter(writer);
writer = new BufferedWriter(writer, DEFAULT_OUTPUT_BUFF_SIZE);
mSOAPPart.writeTo(writer);
writer.flush();
} catch (java.io.IOException e) {
log.error(Messages.getMessage("javaIOException00"), e);
}
} else {
try {
mAttachments.writeContentToStream(os);
} catch (java.lang.Exception e) {
log.error(Messages.getMessage("exception00"), e);
}
}
}
-----Original Message-----
From: Ekbote, Niranjan [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 28, 2003 10:17 AM
To: '[EMAIL PROTECTED]'
Subject: RE: Out of Memory
I am not sure if Axis supports streaming. I think that could solve your
problem.
Thanks!
-- Niranjan.
-----Original Message-----
From: Benedick Mark Chan [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 28, 2003 1:08 PM
To: [EMAIL PROTECTED]
Subject: Re: Out of Memory
Hello David,
Thanks for your reply.
I have tried increasing my heap size dramatically, but still it doesn't
work.
Is this a limitation of axis? If so, then I guess chopping to several small
chucks will be my last resort. =(
Thanks.
-Benedick
----- Original Message -----
From: "David You" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, August 29, 2003 1:03 AM
Subject: RE: Out of Memory
> 1. Are you sure WS is good solution for you?
> 2. If you are sure, try to config VM with more heap size.
> 3. still doesn't work? Try to chop it in several small chunk.
>
> David
>
> -----Original Message-----
> From: Benedick Mark Chan [mailto:[EMAIL PROTECTED]
> Sent: Thursday, August 28, 2003 9:48 AM
> To: [EMAIL PROTECTED]
> Subject: Out of Memory
>
>
> Hello guys,
>
> I would like to ask a question with regards to the memory usage of axis...
>
> I have tried populating 6 million strings to a vector, and return the
vector
> to the client. The server has successfully populated the vector with 6
> million
> strings, but when the server send the vector to the client, the server
> throws an
> out of memory exception. Is there any way to solve this problem? Please
help
> me.
>
> Thanks.
>
> Sincerely Yours,
>
> Benedick
>