Subversion Repositories SmartDukaan

Rev

Rev 9860 | Rev 9865 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9860 Rev 9864
Line 874... Line 874...
874
				hwb.write(fileOut);
874
				hwb.write(fileOut);
875
			} catch (IOException e) {
875
			} catch (IOException e) {
876
				// TODO Auto-generated catch block
876
				// TODO Auto-generated catch block
877
				e.printStackTrace();
877
				e.printStackTrace();
878
			}
878
			}
879
			HttpClient client = new DefaultHttpClient();
-
 
880
			HttpPost post = new HttpPost("http://seller.snapdeal.com/login_security_check?spring-security-redirect=http://seller.snapdeal.com/inventory&");
-
 
881
			BufferedReader rd= null;
-
 
882
			List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
-
 
883
			nameValuePairs.add(new BasicNameValuePair("j_username",
-
 
884
			"khushal.bhatia@saholic.com"));
-
 
885
			nameValuePairs.add(new BasicNameValuePair("j_password",
-
 
886
			"sonline"));
-
 
887
			post.setEntity(new UrlEncodedFormEntity(nameValuePairs,"utf-8"));
-
 
888
			HttpResponse response = null;
-
 
889
			String line;
-
 
890
			try {
-
 
891
				response = client.execute(post);
-
 
892
				rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
-
 
893
				while ((line = rd.readLine()) != null) {
-
 
894
					System.out.println(line);
-
 
895
				}
-
 
896
 
-
 
897
			} catch (ClientProtocolException e) {
-
 
898
				// TODO Auto-generated catch block
-
 
899
				e.printStackTrace();
-
 
900
			} catch (IOException e) {
-
 
901
				// TODO Auto-generated catch block
-
 
902
				e.printStackTrace();
-
 
903
			}
-
 
904
			post = new HttpPost("http://seller.snapdeal.com/inventory/upload");
879
			HttpPost post = new HttpPost("http://seller.snapdeal.com/inventory/upload");
905
			File file = new File(SNAPDEAL_INVENTORY_SHEET);
880
			File file = new File(SNAPDEAL_INVENTORY_SHEET);
906
			MultipartEntity mpEntity = new MultipartEntity();
881
			MultipartEntity mpEntity = new MultipartEntity();
907
			ContentBody cbFile = new FileBody(file,"application/vnd.ms-excel");
882
			ContentBody cbFile = new FileBody(file,"application/vnd.ms-excel");
908
			mpEntity.addPart("file", cbFile);
883
			mpEntity.addPart("file", cbFile);
909
			post.setEntity(mpEntity);
884
			post.setEntity(mpEntity);
910
			response = client.execute(post);
885
			HttpResponse response = client.execute(post);
-
 
886
			BufferedReader rd = null;
911
			try {
887
			try {
912
				rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
888
				rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
913
			} catch (IllegalStateException e1) {
889
			} catch (IllegalStateException e1) {
914
				// TODO Auto-generated catch block
890
				// TODO Auto-generated catch block
915
				e1.printStackTrace();
891
				e1.printStackTrace();
916
			} catch (IOException e1) {
892
			} catch (IOException e1) {
917
				// TODO Auto-generated catch block
893
				// TODO Auto-generated catch block
918
				e1.printStackTrace();
894
				e1.printStackTrace();
919
			}
895
			}
920
			line = "";
896
			String line = "";
921
			String feedresponse = null;
897
			String feedresponse = null;
922
			try {
898
			try {
923
				while ((line = rd.readLine()) != null) {
899
				while ((line = rd.readLine()) != null) {
924
					System.out.println(line);
900
					System.out.println(line);
925
					feedresponse = line;
901
					feedresponse = line;