This week's giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP and have Lucian Maly on-line!
See this thread for details.
Win a copy of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

axis and attachments

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
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));
call.setOperationName(methodName);

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){
System.out.println(e.getMessage());

}
}
}
 
Won't you please? Please won't you be my neighbor? - Fred Rogers. Tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic