Here is my
test code
------------------------------------------------------------------------------------------------
import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.jws.WebService;
import javax.xml.ws.BindingType;
import javax.xml.ws.soap.MTOM;
/**
*
* @author sagar.lakade
*/
@MTOM(threshold = 1, enabled = true )
@BindingType(value=javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING)
@WebService()
public class AttachService {
public DataHandler getFile(
String id) {
FileDataSource fileSource = new FileDataSource("C:\\realtek.log");
return new DataHandler(fileSource);
}
response of web service I got In SOAPUI
-----------------------------------------------------------------------------------------------------------------------------------------
HTTP/1.1 200 OK
X-Powered-By: Servlet/2.5
Server: GlassFish/v3
Content-Type: multipart/related;start="<rootpart*677e28d1-4ba9-4edb-a7ed-7deab5867df0@example.jaxws.sun.com>";type="application/xop+xml";boundary="uuid:677e28d1-4ba9-4edb-a7ed-7deab5867df0";start-info="text/xml"
Transfer-Encoding: chunked
Date: Thu, 08 Apr 2010 13:00:39 GMT
--uuid:677e28d1-4ba9-4edb-a7ed-7deab5867df0
Content-Id: <rootpart*677e28d1-4ba9-4edb-a7ed-7deab5867df0@example.jaxws.sun.com>
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"
Content-Transfer-Encoding: binary
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:getFileResponse xmlns:ns2="http://srvc/"><return>W0luc3RhbGxTaGllbGQgU2lsZW50XQ0KVmVyc2lvbj12Ny4wMA0KRmlsZT1Mb2cgRmlsZQ0KW1Jlc3BvbnNlUmVzdWx0XQ0KUmVzdWx0Q29kZT0wDQpbQXBwbGljYXRpb25dDQpOYW1lPVJlYWx0ZWsgSGlnaCBEZWZpbml0aW9uIEF1ZGlvIERyaXZlcg0KVmVyc2lvbj0yLjMzDQpDb21wYW55PVJlYWx0ZWsgU2VtaWNvbmR1Y3RvciBDb3JwLg0KTGFuZz0wMDA5DQo=</return></ns2:getFileResponse></S:Body></S:Envelope>
--uuid:677e28d1-4ba9-4edb-a7ed-7deab5867df0--
-------------------------------------------------------------------------------------------------------------------------
from above response , we can see that response is inline and not as attachment.
What should be the changes in service provider class so that I get desired result.