You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Brian Rook <br...@gmail.com> on 2005/04/05 18:12:01 UTC

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