Thanks for the response.
If i dont call responseMsg.addAttachmentPart(), i wont be able to add the attachment to the response. Is there any other way to add attachmentpart to the response message to work around this 1.2 bug?
Could you point me to that 1.2 bug? This works on a weblogic server but not websphere.
Regards,
Pradeep
On 2/9/06, Mukesh Kumar Maniraj
<[EMAIL PROTECTED]> wrote:
Pradeep,
You could try using this code,
MessageContext msgContext = MessageContext.getCurrentContext();
if (msgContext != null) {
msgContext.getService().setSendType(Attachments.SEND_TYPE_MIME);
Message responseMsg = msgContext.getResponseMessage(); responseMsg.getAttachmentsImpl().setSendType(Attachments.SEND_TYPE_MIME);
AttachmentPart attachmentPart = new AttachmentPart(new DataHandler(new
FileDataSource(<give the File Path here>)));
}
As note that do not use , responseMsg.addAttachmentPart() method, in Axis 1.2 a call to this method results in the body of the message being skipped.
-MukeshOn 2/8/06, Pradeep Reddy <[EMAIL PROTECTED] > wrote:Hi all,
I am having trouble accessing the Response Message on WebSphere 5.1.1.
I am trying to send an attachment from server to the client. I add it to the response message using this familiar code snippet.
MessageContext msgContext = MessageContext.getCurrentContext();
Message msg = msgContext.getResponseMessage();
msg.getAttachmentsImpl().setSendType(Attachments.SEND_TYPE_MIME);
AttachmentPart part = new AttachmentPart(new DataHandler(new ArtifactDataSource( ais.getInfo().getName(),ais.getInputStream(),ais.getContentType().toString())));//ArtifactDataSource is a custom implementation of datasource
part.setContentId (ais.getInfo().getName());
msg.addAttachmentPart(part);
msg.saveChanges();
this code returns an attachment on weblogic 8.1. On WebSphere 5.1.1, i am getting back a response with no xml message in it. I just get back these headers with no xml message or the attachment.HTTP/1.1 200 OK
Date: Wed, 08 Feb 2006 20:48:43 GMT
Server: IBM_HTTP_SERVER/1.3.28.1 Apache/1.3.28 (Unix)
Connection: close
Content-Type: multipart/related; type="text/xml"; start="<AA9A919955D1C926B85316860BEE7F3F>"; boundary= 1446154572.1139431723394.JavaMail.test.bluto
To debug, I retained only these calls:
MessageContext msgContext = MessageContext.getCurrentContext();
Message msg = msgContext.getResponseMessage();
This returned an empty soap message.HTTP/1.1 200 OK
Date: Wed, 08 Feb 2006 22:00:48 GMT
Server: IBM_HTTP_SERVER/1.3.28.1 Apache/1.3.28 (Unix)
Connection: close
Content-Type: text/xml; charset=utf-8
<soapenv:Envelope xmlns:soapenv=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body/>
</soapenv:Envelope>
So when i call getResponseMessage(), its going through a seperate path and giving me a brand new response. I am using axis 1.2 RC2.
Any help on what i can do to work around this problem would be greatly appreciated.
Thanks,
Pradeep
