how to send attachments with jax-ws?
I want to send a soap request with attachments in my client app.
This is how I tried to send the attachments (can be images, sound..).
SendMessageService sendMessageService = new SendMessageService();
SendMessage sendMessage = endMessageService.getSendMessage();
DataSource dataSource = new FileDataSource(files[i]);
DataHandler dataHandler = new DataHandler(dataSource);
Map messageContext = ((BindingProvider)sendMessage).getRequestContext();
But when I try to send a get
javax.xml.ws.WebServiceException: java.lang.RuntimeException: javax.xml.soap.SOAPException: java.lang.ClassCastException: javax.activation.DataHandler
So my question is how I in a simple way is going to attach my File to my SOAP message with JAX-WS?
I know that with Apache's Axis there is a method called org.apache.axis.client.Stub.addAttachment(Object arg0) and I'm porting the application from Axis to JAX-WS...