• Post Reply Bookmark Topic Watch Topic
  • New Topic

axis and attachments  RSS feed

regina dietiker
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am writing a webservice which gets an attachment as input and sends an attachment back. i am using tomcat 4.1.29 and axis 1.1. i tried to run an example, but it always throws an exception:
nested exception is:
java.io.IOException: No support for attachments
mail.jar and activation.jar are in my classpath.
deploying is no problem.
i hope somebody can help me.
cu. regina

here the two example classes:
import java.net.URL;
import java.io.*;
import java.util.StringTokenizer;
import javax.activation.DataHandler;
public class GreetingService2{
public DataHandler sayHello(DataHandler dh){
return dh;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.encoding.ser.*;
import javax.activation.*;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
public class AxisAttachmentClient {
public static void main (String[] args){
try {
String fileName = "attachment.txt";
DataHandler dhandler = new DataHandler(new FileDataSource(fileName));

String endpointURL = "http://localhost:8080/axis/services/greetingService2";
String methodName = "sayHello";

Service service = new Service();

Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpointURL));

QName qn = new QName("greetingService2", "DataHandler");

call.registerTypeMapping(dhandler.getClass(), qn, JAFDataHandlerSerializerFactory.class, JAFDataHandlerDeserializerFactory.class);
dhandler = (DataHandler) call.invoke(new Object[]{dhandler});

} catch(Exception e){

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!