我需要通过 android 应用程序向 webservice -asp.net- 发送多个值
这是网络服务方法
<WebMethod()> _
Public Function AddTheNums(ByVal nums() As String,) As String
For i = 0 To nums.Length - 1
--some process
Next
Return status
End Function
我在android中使用这个代码
public class Login extends AsyncTask<String, Void, String>
{
public Login(String MethodName)
{
}
public void onPreExecute()
{
}
@Override
protected String doInBackground(String... params)
{
final SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("nums", params[0]);
request.addProperty("nums", params[1]);
final SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
envelope.dotNet = true;
try
{
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive result = (SoapPrimitive) envelope.getResponse();
response = result.toString();
}
return response;
}
@Override
public void onPostExecute(String res)
{
}
}
任何人都可以帮助我吗?我需要将多个数字发送到 webserive 中的参数
我用了这段代码
request.addProperty("nums", params[0]);
request.addProperty("nums", params[1]);
但它不能正常工作......
此致