This week's book giveaway is in the Security forum.
We're giving away four copies of Penetration Testing Basics and have Ric Messier on-line!
See this thread for details.
Win a copy of Penetration Testing Basics this week in the Security forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

axis and attachments

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: 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.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();

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){

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic