Forum Discussion

ankurpathak's avatar
New Contributor
6 years ago

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 xmlns:S="">
<S:Fault xmlns:ns4="">
<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.


1 Reply

  • ankurpathak's avatar
    New Contributor

    @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();