Subversion Repositories SmartDukaan

Rev

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

Rev 10138 Rev 10162
Line 17... Line 17...
17
import org.apache.http.message.BasicNameValuePair;
17
import org.apache.http.message.BasicNameValuePair;
18
 
18
 
19
public class UpdateSDIUsingPanel {
19
public class UpdateSDIUsingPanel {
20
	private static DefaultHttpClient client = new DefaultHttpClient();
20
	private static DefaultHttpClient client = new DefaultHttpClient();
21
	public static void main(String... args) throws ClientProtocolException, IOException{
21
	public static void main(String... args) throws ClientProtocolException, IOException{
-
 
22
		UpdateSDIUsingPanel UDSI = new UpdateSDIUsingPanel();
22
		handleLogin();
23
		UDSI.handleLogin();
23
		updateInventory(308L,"SDL061548809");
24
		UDSI.updateInventory(308L,"SDL061548809");
24
 
25
 
25
	}
26
	}
26
	static int updateInventory(long stock,String supc) throws ClientProtocolException, IOException{
27
	int updateInventory(long stock,String supc) throws ClientProtocolException, IOException{
27
		HttpPost post = new HttpPost("http://seller.snapdeal.com/inventory/update");
28
		HttpPost post = new HttpPost("http://seller.snapdeal.com/inventory/update");
28
		List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
29
		List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
29
		nameValuePairs.add(new BasicNameValuePair("availableInventory",
30
		nameValuePairs.add(new BasicNameValuePair("availableInventory",
30
				String.valueOf(stock)));
31
				String.valueOf(stock)));
31
		nameValuePairs.add(new BasicNameValuePair("id",
32
		nameValuePairs.add(new BasicNameValuePair("id",
Line 39... Line 40...
39
			System.out.println(line);
40
			System.out.println(line);
40
		}
41
		}
41
		return 1;
42
		return 1;
42
	}
43
	}
43
 
44
 
44
	public static void handleLogin() throws ClientProtocolException, IOException{
45
	public void handleLogin() throws ClientProtocolException, IOException{
45
		HttpGet get = new HttpGet("http://selleraccounts.snapdeal.com/keymaker/login");
46
		HttpGet get = new HttpGet("http://selleraccounts.snapdeal.com/keymaker/login");
46
		HttpResponse response = null;
47
		HttpResponse response = null;
47
		try {
48
		try {
48
			response = client.execute(get);
49
			response = client.execute(get);
49
		} catch (ClientProtocolException e) {
50
		} catch (ClientProtocolException e) {