Well, looks like client doesn't know how to handle application/octet-stream. You may want to try couple of things - Try with application/zip - Save to a file and use FileDataSource just for testing. If can fail if you have a serializer/config issue. Assume you are using Axis on both ends.
Jai -----Original Message----- From: Brian Rook [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 05, 2005 12:31 PM To: axis-user@ws.apache.org Subject: Re: attachments question damn, forgot to include the console too...here's the exception I get on the console. This says that the exception is on the server side. 2005-04-05 11:28:16,203 ERROR [MimeUtils] java.io.IOException: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type application/octet-stream at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:851) at javax.activation.DataHandler.writeTo(DataHandler.java:305) at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1147) at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:668) at javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:232) at com.sun.mail.handlers.multipart_mixed.writeTo(multipart_mixed.java:67) at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:849) at javax.activation.DataHandler.writeTo(DataHandler.java:305) at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1147) at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1600) at org.apache.axis.attachments.MimeUtils.writeToMultiPartStream(MimeUtils.java:202) at org.apache.axis.attachments.AttachmentsImpl.writeContentToStream(AttachmentsImpl.java:461) at org.apache.axis.Message.writeTo(Message.java:529) at org.apache.axis.transport.http.AxisServlet.sendResponse(AxisServlet.java:822) On Apr 5, 2005 11:24 AM, Brian Rook <[EMAIL PROTECTED]> wrote: > BTW, this is what came through on tcpmon. It looks like the binary > data was sent, and the exception is on the client side. > > HTTP/1.1 200 OK > > X-Powered-By: Servlet 2.4; Tomcat-5.0.28/JBoss-3.2.6 (build: > CVSTag=JBoss_3_2_6 date=200410140106) > > Content-Type: multipart/related; type="text/xml"; > start="<240740715F1EED4240F4AD018D2835D6>"; > boundary="----=_Part_3_11509108.1112721764250"Date: Tue, 05 Apr 2005 > 17:22:44 GMTServer: Apache-Coyote/1.1Connection: > close------=_Part_3_11509108.1112721764250Content-Type: text/xml; > charset=UTF-8Content-Transfer-Encoding: binaryContent-Id: > <240740715F1EED4240F4AD018D2835D6> > <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> > <getPendingOrdersReturn xmlns="urn:EIWOWS"> > <ns1:confirmationCode > xmlns:ns1="http://websvc.eiwo.childsupport.colorado.gov">-200504051758437</ns1:confirmationCode> > <ns2:pendingZip > href="cid:CFF956D504D89245943967B50CB04C4C" > xmlns:ns2="http://websvc.eiwo.childsupport.colorado.gov"/> > </getPendingOrdersReturn> > </soapenv:Body> > </soapenv:Envelope> > > ------=_Part_3_11509108.1112721764250 > > Content-Type: application/octet-stream > > Content-Transfer-Encoding: binary > > Content-Id: > <CFF956D504D89245943967B50CB04C4C> > > > On Apr 5, 2005 11:19 AM, Brian Rook <[EMAIL PROTECTED]> wrote: > > 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] > > <[EMAIL PROTECTED]> wrote: > > > Try mimetype='application/octet-stream'. > > > > > > Jai > > > > > > -----Original Message----- > > > From: Brian Rook [mailto:[EMAIL PROTECTED] > > > 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] > > > <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED] > > > > 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 > > > > > > > > > >