axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Rook <brian.r...@gmail.com>
Subject Re: attachments question
Date Tue, 05 Apr 2005 17:19:58 GMT
okay, tried that.  I get a different message now:

java.lang.RuntimeException: javax.mail.MessagingException: Error in
input stream;
  nested exception is:
	java.io.IOException: End of stream encountered before final boundary marker.

This method works when I call it from a servlet, so I'm pretty sure
that the byte[] contains all the data it should have.


On Apr 5, 2005 10:52 AM, THOMAS, JAI [AG-Contractor/1000]
<jai.thomas@monsanto.com> wrote:
> Try mimetype='application/octet-stream'.
> 
> Jai
> 
> -----Original Message-----
> From: Brian Rook [mailto:brian.rook@gmail.com]
> Sent: Tuesday, April 05, 2005 11:38 AM
> To: axis-user@ws.apache.org
> Subject: Re: attachments question
> 
> I'm actually creating the zip file in memory and passing a reference
> to the byte[] created.  My service is based on an ejb method that
> looks like this:
> 
> public byte[] getZipOutput(WageWithholdingTO[] wwArray)
> 
> I would prefer not to write the file to the file system and then read
> it from there just to create the datahandler.  Also I need to provide
> both the string (confirmationCode) and the datahandler in the soap
> response.
> 
> How do you mean 'make sure there is a typemapping registered for
> datahandler'?  When you create a datahandler you have to specify a
> typemapping ("multipart/*"), right?  Is there something else I'm
> missing?
> 
> On Apr 5, 2005 10:24 AM, THOMAS, JAI [AG-Contractor/1000]
> <jai.thomas@monsanto.com> wrote:
> > If you are attaching an already created zip file, create data handler from FileDataSource.
> > That way, you let datahandler to set the appropriate mime type.
> >   dhSource = new DataHandler(new FileDataSource(docFile));
> >
> > Also make sure there is typemapping registered for DataHandler.
> >
> > Jai
> >
> >
> > -----Original Message-----
> > From: Brian Rook [mailto:brian.rook@gmail.com]
> > Sent: Tuesday, April 05, 2005 11:12 AM
> > To: axis-user@ws.apache.org
> > Subject: attachments question
> >
> > I'm trying to send back both a string and a zip file from a webservice
> > built using axis1_2RC1. here's the entry in the wsdl:
> >
> >     code:
> >
> >   <schema xmlns="http://www.w3.org/2001/XMLSchema"
> > targetNamespace="http://websvc.eiwo.childsupport.colorado.gov"
> > elementFormDefault="qualified">
> >    <import namespace="http://xml.apache.org/xml-soap"/>
> >    <complexType name="PendingCaseTO">
> >     <sequence>
> >      <element name="confirmationCode" nillable="true" type="xsd:string"/>
> >      <element name="pendingZip" nillable="true" type="apachesoap:DataHandler"/>
> >     </sequence>
> >    </complexType>
> >   </schema>
> >
> > I can build and deploy and call the service but it fails with this message:
> >
> >     code:
> >
> > AxisFault
> >  faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
> >  faultSubcode:
> >  faultString: java.lang.ClassCastException
> >  faultActor:
> >  faultNode:
> >  faultDetail:
> >         {http://xml.apache.org/axis/}stackTrace:java.lang.ClassCastException
> >         at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1056)
> >         at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:824)
> >         at javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:215)
> >         at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1056)
> >         at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:1914)
> >         at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:1895)
> >         at org.apache.axis.attachments.MimeUtils.writeToMultiPartStream(MimeUtils.java:201)
> >
> > Here's the line that creates the datahandler:
> >
> > DataHandler dh = new DataHandler(zipBytes,"multipart/*");
> >
> > zipBytes is a byte[] and I wasn't sure what to use for the mime type
> > so I used multipart/*, but that doesn't seem to work.
> >
> > Are there any suggestions on how to send the attachment correctly?
> >
> > Thank you
> >
>

Mime
View raw message