-
1. Re: specifying DataHandler as input argument for webservice
berkgypsy Sep 19, 2002 3:59 PM (in response to filipdef)Here is my code that works and does pretty much the same thing, but I'm using axis b2...
DataHandler dhSource = new DataHandler( new FileDataSource( filename ));
Service service = new Service();
Call call = (Call) service.createCall();
logger.info("Invoking the service at " + serviceURL);
call.setTargetEndpointAddress( new URL(serviceURL) ); //Set the target service host and service location
call.setOperationName(new QName("urn:UploadManagerService","upload") ); //This is the target service method to invoke.
QName qnameAttachment = new QName("urn:UploadManagerService", "DataHandler");
call.registerTypeMapping(dhSource.getClass(),//Add serializer for attachment.
qnameAttachment,
JAFDataHandlerSerializerFactory.class,
JAFDataHandlerDeserializerFactory.class);
result = (String)call.invoke( new Object[] { dhSource } ); //Add the attachment.