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 eagle1978 <ea...@gmx.de> on 2004/08/02 16:11:41 UTC

Problems with DataHandler

Hi,

I've a problem with axis.
I try to develop a webservice application which receives some files and send
some files back.
The webservice is implemented in .NET. (this part works without a problem, I
tested it with a .NET client) The client is implemented in Java.

My problem is how to get the attachment from the webservice answer.

Here is my current code:
      archive.process();
      
      Object attReturn[] = archive.getAttachments();
      int nrAttachments = attReturn.length;
      System.out.println("Anzahl der empfangenen Attachments " +
nrAttachments);
      DataHandler dhReturn;
      OutputStream os;
      FileOutputStream fileOut;

      for (int i = 0; i < nrAttachments - 1; i++) {
        System.out.println(retPath + i + ".txt " + attReturn.length );

        dhReturn = new DataHandler(attReturn[i],
"application/octet-stream");      

        fileOut = new FileOutputStream( retPath + i + ".txt" );
        dhReturn.writeTo(fileOut);
      }

When I run this code I get the following error message:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type
application/octet-stream

It doesn't matter what kind of mime type I use, I always get the same error
message!
Any suggestions?

Thanks in advance!

Regards
Alex