I wanted to send XML file as attachment over URL from Java class
Code with which i am trying is as below
File request_XML_file = new File("src/request.xml");
URL url = new URL("https://************?p_xml_file="+request_XML_file);
conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("enctype","multipart/form-data");
But value passed for p_xml_file is src/request.xml
After 2 days search got some use full stuff and its worked for me.. No need to import any additional Jar file.. If we wanted to send an file as attachment over RESTFul Web service URL MultipartUtility is correct why to do it.. Here we go..!! A ready made code --> http://www.codejava.net/java-se/networking/upload-files-by-sending-multipart-request-programmatically