01.
public
void
invokeJSONWSSentEmp(List<String> empId, String methodName) {
02.
03.
ArrayList<JSONObject> MyArrJson =
new
ArrayList<JSONObject>();
04.
JSONObject object;
05.
06.
07.
for
(
int
i=
0
; i<empId.size() ;i++) {
08.
object =
new
JSONObject();
09.
try
{
10.
object.put(
"empId"
, empId.get(i).toString());
11.
}
catch
(JSONException e) {
12.
13.
e.printStackTrace();
14.
}
15.
MyArrJson.add(object);
16.
}
17.
JSONArray json =
new
JSONArray(MyArrJson);
18.
19.
SoapObject request =
new
SoapObject(NAMESPACE, methodName);
20.
PropertyInfo paramPI =
new
PropertyInfo();
21.
paramPI.setName(
"emp"
);
22.
paramPI.setValue(json);
23.
paramPI.setType(json.getClass());
24.
request.addProperty(paramPI);
25.
SoapSerializationEnvelope envelope =
new
SoapSerializationEnvelope(
26.
SoapEnvelope.VER11);
27.
envelope.dotNet =
true
;
28.
envelope.setOutputSoapObject(request);
29.
HttpsTransportSE androidHttpTransport =
new
HttpsTransportSE(URL,
443
,
"/vehicle.asmx?WSDL"
,
5000
);
30.
androidHttpTransport.debug =
true
;
31.
try
{
32.
androidHttpTransport.call(SOAP_ACTION+methodName, envelope);
33.
Log.d(TAG,
"Come in try"
);
34.
SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
35.
responseJSON = response.toString();
36.
Log.d(TAG,
""
+responseJSON);
37.
}
catch
(Exception e) {
38.
e.printStackTrace();
39.
}
40.
}
41.