So, have you tried the example under AXIS1.1_ROOT/samples/attachments? I tried it but not successful. I think the problem is because of using DataHandler as parameter. I just started using Axis. So I want to confirm this with experts.
Haven't tried the example, mine is a pretty simple thing and known to work with other SOAP implementations. The key thing here is that it even works with Axis, but only on the server side. So it's some artifact of the call() logic on the client side that messes things up.
As noted in my followup (to which you replied), I have a workaround for the client side bug.
Thanks for the reply.
Dave
regards
Jia Yiyu
-----Original Message----- From: Jeffrey Tenny [mailto:[EMAIL PROTECTED] Sent: Monday, October 04, 2004 8:46 AM To: [EMAIL PROTECTED] Subject: Re: SOAPMessage, AttachmentPart problem
I have more data and a workaround. This is a client-side bug/feature.
It's either the "application/zip" or use of the DataHandler that causes the client SOAPConnection.call() to mess up.
When I just pass an InputStream to AttachmentPart.setContent (instead of AttachmentPart.setDataHandler()), and use "application/octet-stream" for the type, the client will work.
Note that what fails on the client works on the server, so it's the call() side of things that's failing to deliver content over the wire. Using the DataHandler and "application/zip" on the server worked just fine, but the server isn't doing a call() method, it's replying over an existing socket.
So I'm set for now, but there's a bug lurking here on the client side.
Jeffrey Tenny wrote:
I have some kind of RPC layer bug I think with Axis, both 1.1 and 1.2alpha.
I construct SOAPMessage objects with 2 attachments. The first is just a string, which happens to contain XML, the second is an InputStream attached to a ByteArrayOutputStream.
E.g. 1st attachment:
_mainAttachment = _soapMessage.createAttachmentPart() ; _mainAttachment.setContent(xmlRequest /*a string*/, "text/plain") ; _mainAttachment.setContentLocation("my.main.location") ; _soapMessage.addAttachmentPart(_mainAttachment) ;
2nd attachment: _zipAttachment = _soapMessage.createAttachmentPart() ; BinaryDataSource bds = new BinaryDataSource(zipContent /* InputStream */, "application/zip") ; DataHandler dh = new DataHandler(bds) ; _zipAttachment.setDataHandler(dh) ; _zipAttachment.setContentLocation("my.zip.location") ; _soapMessage.addAttachmentPart(_zipAttachment) ;
I do this for SOAPMessages constructed at both ends, a Client sending a SOAPMessage to the server, and the server constructing a SOAPMessage for reply to the client.
The code all worked under the SUN SOAP implementation. It works when the server constructs a reply to the client. It works when the client sends the server, but ONLY FOR ONE ATTACHMENT.
Only in the client->server case, and only when the second binary attachment is present, does the transmission fail.
The server gets the POST headers, but no content! (Here is debugging output):
Header: 'content-type' = 'multipart/related; type="text/xml"; start="<85727EBBCEA55FFCA1FAE7310B6D93B6>"; boundary="----=_Part_1_23763868.1096587242955"' Content: ''
I've attached the debugger to the client. I can see the attachments being added, and my DataSource.getContent() method is being called, as is the getContentType() method.
But the client just doesn't seem to transmit this stuff to the server. I haven't figured it out yet.
Anybody else have this issue and/or know of solutions/workarounds?
The client sends the request with
_soapMessage.saveChanges() ; reply = _soapConnection.call(_soapMessage, _destination) ; _soapConnection.close() ;
The only other pecular thing is that the client seems to hang waiting for the server response, which it eventually gets, after the 60 second socket timeout, but I'm not sure whose timing out (client or server).
The server doesn't seem to hang though, there's no stall getting the fact that there was no content after the mime headers in the POST request. If the server replies right away, I'm unsure why the client must wait so long for the result.
JAVA 1.4.2_05 TOMCAT 5.0.28 AXIS 1.1 and/or 1.2alpha, I tried both REDHAT Linux 9
Any advice appreciated.