Ask a Question

Soap With SwaRef Not Working

ankurpathak
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 xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope">
<faultcode>S:Server</faultcode>
<faultstring>No such MIME Part: Part=231405110846:null</faultstring>
</S:Fault>
</S:Body>
</S:Envelope>

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

 

1 REPLY 1
ankurpathak
New Contributor

@WebService
@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
@WebMethod
@XmlAttachmentRef
DataHandler downloadDataHandler();

@WebMethod
void uploadDataHandler(@XmlAttachmentRef DataHandler dataHandler);

}

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


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

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

}

cancel
Showing results for 
Search instead for 
Did you mean: