Showing results for 
Search instead for 
Did you mean: 

Soap With SwaRef Not Working

New Contributor

Soap With SwaRef Not Working

I am trying to test swaRef attachment with Soap UI and its not working. On debugging I am finding that its not sending

the mime of attachment so its not working. Why it doesn't send mime even when it has knowledge of same for SwaRef??

The Response I Get From Server Is:

<S:Envelope xmlnsSmiley Frustrated="">
<S:Fault xmlns:ns4="">
<faultcode>SSmiley Frustratederver</faultcode>
<faultstring>No such MIME Part: Part=231405110846:null</faultstring>

I am useing JAX-WS server and client side code. Its working with JAX-WS client code.


New Contributor

Re: Soap With SwaRef Not Working

@SOAPBinding(style = Style.DOCUMENT)
public interface ImageServerSwa {

Path PATH_UPLOAD = Paths.get("/", "home", "ankur", "soap", "kotak.jpg");

Path PATH_DOWNLOAD = Paths.get("/", "home", "ankur", "Pictures", "kotak.jpg");

//download a image from server
DataHandler downloadDataHandler();

void uploadDataHandler(@XmlAttachmentRef DataHandler dataHandler);


@WebService(endpointInterface = "com.github.ankurpathak.soap.ImageServerSwa")
public class ImageServerSwaImpl implements ImageServerSwa {

public DataHandler downloadDataHandler() {
File file = PATH_DOWNLOAD.toFile();
FileDataSource dataSource = new FileDataSource(file);
DataHandler dataHandler = new DataHandler(dataSource);
return dataHandler;

public void uploadDataHandler(@XmlAttachmentRef DataHandler data) {
if (data != null) {
File file = PATH_UPLOAD.toFile();
try {
FileUtils.copyInputStreamToFile(data.getInputStream(), file);
} catch (IOException ex) {
throw new WebServiceException();


New Here?
Join us and watch the welcome video:
Watch the New Interview
Join the exciting event
Top Kudoed Authors
Join the September Hub-bub to show off, learn and win