| 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 |
System.out.println("Inside main");
|
| 22 |
UpdateSDIUsingPanel UDSI = new UpdateSDIUsingPanel();
|
23 |
UpdateSDIUsingPanel UDSI = new UpdateSDIUsingPanel();
|
| - |
|
24 |
System.out.println("Created UD Inventory object");
|
| 23 |
UDSI.updateInventory(308L,"SDL061548809");
|
25 |
UDSI.updateInventory(98L,"SDL061548809");
|
| - |
|
26 |
System.out.println("After calling update inventory");
|
| 24 |
|
27 |
|
| 25 |
}
|
28 |
}
|
| 26 |
int updateInventory(long stock,String supc) throws ClientProtocolException, IOException{
|
29 |
int updateInventory(long stock,String supc) throws ClientProtocolException, IOException{
|
| 27 |
HttpPost post = new HttpPost("http://seller.snapdeal.com/inventory/update");
|
30 |
HttpPost post = new HttpPost("http://seller.snapdeal.com/inventory/update");
|
| 28 |
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
|
31 |
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
|
| 29 |
nameValuePairs.add(new BasicNameValuePair("availableInventory",
|
32 |
nameValuePairs.add(new BasicNameValuePair("availableInventory",
|
| 30 |
String.valueOf(stock)));
|
33 |
String.valueOf(stock)));
|
| 31 |
nameValuePairs.add(new BasicNameValuePair("id",
|
34 |
nameValuePairs.add(new BasicNameValuePair("supc",
|
| 32 |
supc));
|
35 |
supc));
|
| 33 |
nameValuePairs.add(new BasicNameValuePair("oper","edit"));
|
36 |
nameValuePairs.add(new BasicNameValuePair("oper","edit"));
|
| 34 |
post.setEntity(new UrlEncodedFormEntity(nameValuePairs,"utf-8"));
|
37 |
post.setEntity(new UrlEncodedFormEntity(nameValuePairs,"utf-8"));
|
| 35 |
HttpResponse response = client.execute(post);
|
38 |
HttpResponse response = client.execute(post);
|
| 36 |
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
|
39 |
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
|