我正在尝试使用带有Dot42的ksaop2-android库,在达到我认为可以测试的点之后,我在成功构建后得到了上述错误。我在调试模式下启动。我以前从未见过这种错误,也不知道在哪里开始纠正它。我在最新更新后成功运行了Dot42的默认应用程序模板。我正在使用Visual Studio 2012.我已在清单文件中启用了INTERNET权限。这是我的代码:
using System;
using Android.App;
using Android.Os;
using Android.Widget;
using Dot42;
using Dot42.Manifest;
using Org.Ksoap2.Serialization;
using Org.Ksoap2.Transport;
[assembly: Application("dot42Application7")]
namespace dot42Application7
{
[Activity]
public class MainActivity : Activity
{
private string NAMESPACE = "http://reps.catalystinnovations.net/";
private string URL = "http://reps.catalystpromotions.net/T-ShirtPricing.asmx";
protected override void OnCreate(Bundle savedInstance)
{
base.OnCreate(savedInstance);
SetContentView(R.Layouts.MainLayout);
TryWebService();
}
public void TryWebService()
{
string METHOD_NAME = "GetTShirtPricingString";
string SOAP_ACTION = NAMESPACE + METHOD_NAME;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo password = new PropertyInfo();
password.SetName("password");
password.SetValue("password");
password.SetType(typeof(string));
PropertyInfo numColors = new PropertyInfo();
numColors.SetName("color");
numColors.SetValue("White");
// numColors.setValue("White");
numColors.SetType(typeof(string));
PropertyInfo numShirts = new PropertyInfo();
numShirts.SetName("weight");
double w = 5.4d;
numShirts.SetValue(w.ToString());
// numShirts.setValue("5.4");
numShirts.SetType(typeof(string));
request.AddProperty(password);
request.AddProperty(numColors);
request.AddProperty(numShirts);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(Org.Ksoap2.SoapEnvelope.VER11);
envelope.DotNet = true;
envelope.SetOutputSoapObject(request);
envelope.ImplicitTypes = true;
HttpTransportSE transport = new HttpTransportSE(URL);
try
{
transport.Call(SOAP_ACTION, envelope);
SoapPrimitive response = (SoapPrimitive)envelope.GetResponse();
string result = response.ToString();
int i = 0;
}
catch(Exception e)
{
e.PrintStackTrace();
}
}
}
}