Android:faultactor:';空';调用webservice时发生详细信息错误

Android:faultactor:';空';调用webservice时发生详细信息错误,android,web-services,null,asmx,android-ksoap2,Android,Web Services,Null,Asmx,Android Ksoap2,我正在开发一个应用程序,它从android获取位置详细信息,并将其发送到vb.net Web服务,以便将其插入数据库。 当我访问localhost web服务进行测试时,我成功地将位置详细信息插入到数据库中。 但是当我调用实际的Web服务器时,我得到了以下异常 05-27 12:21:37.477: I/System.out(276): SetLocationForAndroid{Latitude=37.422005; Longitude=-122.084095; sAddress=Charle

我正在开发一个应用程序,它从android获取位置详细信息,并将其发送到vb.net Web服务,以便将其插入数据库。 当我访问localhost web服务进行测试时,我成功地将位置详细信息插入到数据库中。 但是当我调用实际的Web服务器时,我得到了以下异常

05-27 12:21:37.477: I/System.out(276): SetLocationForAndroid{Latitude=37.422005; Longitude=-122.084095; sAddress=Charleston Road, Mountain View, San Jose; sLocality=California; sCountry=United States; sUserId=1004; }
05-27 12:21:39.998: E/Error :(276): Exception: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Exception: Object reference not set to an instance of an object.
05-27 12:21:39.998: E/Error :(276):    at WebService.SetLocationForAndroid(String Latitude, String Longitude, String sAddress, String sLocality, String sCountry, String sUserId)
05-27 12:21:39.998: E/Error :(276):    --- End of inner exception stack trace ---
05-27 12:21:39.998: W/System.err(276): SoapFault - faultcode: 'soap:Server' faultstring: 'System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Exception: Object reference not set to an instance of an object.
05-27 12:21:40.008: W/System.err(276):    at WebService.SetLocationForAndroid(String Latitude, String Longitude, String sAddress, String sLocality, String sCountry, String sUserId)
05-27 12:21:40.008: W/System.err(276):    --- End of inner exception stack trace ---' faultactor: 'null' detail: org.kxml2.kdom.Node@43e626e0
我浏览了这么多的帖子,但是我没有弄清楚这个问题/ 有人能告诉我怎么了吗

我的Web服务代码:

<WebMethod()> _
    Public Function SetLocationForAndroid(ByVal Latitude As String, ByVal Longitude As String, ByVal sAddress As String, ByVal sLocality As String, ByVal sCountry As String, ByVal sUserId As String) As String

        Dim sdr As New DataSet()
        Dim dt As New DataTable()
        Dim dl As New DL.clsDataLayer
        Dim strquery As String

        Dim sLatitude As Double = CDbl(Latitude)
        Dim sLongitude As Double = CDbl(Longitude)

        'Dim longitude = xDoc.SelectSingleNode("/GeocodeResponse/result/geometry/location/lng").InnerText
        Try
            With dl
                '.SqlQuery = "INSERT INTO MAP (LATITUDE,LONGITUDE,SERVER_DATE,ADDRESS,LOCALITY,COUNTRY,USER_ID,WEB_ENTRY) VALUES (" + dLatitude.ToString() + "," + dLongitude.ToString() + ",getdate(),'" + sAddress.Replace("'", "''") + "','" + sLocality.Replace("'", "''") + "','" + sCountry.Replace("'", "''") + "','" + sUserId + "',0 )"
                .SqlQuery = "INSERT INTO MAP (LATITUDE,LONGITUDE,SERVER_DATE,ADDRESS,LOCALITY,COUNTRY,USER_ID,WEB_ENTRY) VALUES (" + sLatitude.ToString + "," + sLongitude.ToString + ",getdate(),'" + sAddress.Replace("'", "''") + "','" + sLocality.Replace("'", "''") + "','" + sCountry.Replace("'", "''") + "','" + sUserId + "',0 )"
                strquery = "INSERT INTO MAP (LATITUDE,LONGITUDE,SERVER_DATE,ADDRESS,LOCALITY,COUNTRY,USER_ID,WEB_ENTRY) VALUES (" + sLatitude.ToString + "," + sLongitude.ToString + ",getdate(),'" + sAddress.Replace("'", "''") + "','" + sLocality.Replace("'", "''") + "','" + sCountry.Replace("'", "''") + "','" + sUserId + "',0 )"
                sdr = .fnGetData
            End With
            Return strquery

            'Dim conn As New SqlConnection
            'conn.ConnectionString = "Data Source = 62.75.229.51; Initial Catalog = Silver_WebPH; User id =Silver_Webph; password =sbyadmin1"
            'Dim strSql As String = "INSERT INTO MAP (LATITUDE,LONGITUDE,SERVER_DATE,ADDRESS,LOCALITY,COUNTRY,USER_ID,WEB_ENTRY) VALUES (" + sLatitude.ToString + "," + sLongitude.ToString + ",getdate(),'" + sAddress.Replace("'", "''") + "','" + sLocality.Replace("'", "''") + "','" + sCountry.Replace("'", "''") + "','" + sUserId + "',0 )"
            'conn.Open()
            'Dim cmd As New SqlCommand
            'cmd.Connection = conn
            'cmd.CommandText = strSql
            'cmd.CommandType = CommandType.Text
            'cmd.ExecuteNonQuery()
            'Return True
        Catch ioEx As IO.IOException
            ' Handle other non-specific IO Exceptions here.
            Throw New Exception(ioEx.Message.ToString)
        Return strquery     
            'Return ioEx.Message.ToString

        Catch ex As Exception
            ' Handle any other non-IO Exception here.
            Throw New Exception(ex.Message.ToString)
        Return strquery     
            'Return ex.Message.ToString
        End Try

    End Function
_
公共函数SetLocationForAndroid(ByVal纬度为字符串,ByVal经度为字符串,ByVal鞍形为字符串,ByVal慢度为字符串,ByVal Scontry为字符串,ByVal sUserId为字符串)为字符串
作为新数据集的Dim sdr()
Dim dt作为新数据表()
将dl设置为新dl.clsDataLayer
作为字符串的Dim strquery
双色板尺寸=CDbl(纬度)
Dim sLongitude为双精度=CDbl(经度)
'Dim longitude=xDoc.SelectSingleNode(“/GeocodeResponse/result/geometry/location/lng”)。InnerText
尝试
用dl
“.SqlQuery=”将值(“+dLatitude.ToString()+”、“+dLongitude.ToString()+”、“+dLongitude.ToString()+”、getdate()、“+sAddress.Replace(”、““”)+”、“+sLocality.Replace(“、”、“)+”、“+Scontry.Replace(“、”、“、”、“+sUserId+”、“、”)0)”插入地图(纬度、经度、服务器、国家、用户ID、网络条目)
.SqlQuery=“将值(“+sLatitude.ToString+”、“+sLongitude.ToString+”、“+sLongitude.ToString+”、getdate()、“+sAddress.Replace(”、“”)+”、“+sLocality.Replace(“、”、“)+”、“+scontry.Replace(“、”、“、”)+”、“+scontry.Replace(“、”、“、“、”)+”、“+sUserId“、”0)”插入地图(纬度、经度、经纬度、经度、经度、经度、经度)
strquery=“将值(“+sLatitude.ToString+”、“+sLongitude.ToString+”、“+sLongitude.ToString+”、getdate()、“+sAddress.Replace(”、“”)+”、“+sLocality.Replace(“、”)、“+sLocality.Replace(”、“、”)+”、“+scontry.Replace(“、”、“、“、”)+”、“+sUserId“、”、0)”插入地图(纬度、经纬度、经度、经度、经度、经度)
sdr=.fnGetData
以
返回strquery
'Dim conn作为新的SqlConnection
'conn.ConnectionString=“数据源=62.75.229.51;初始目录=Silver\u WebPH;用户id=Silver\u WebPH;密码=sbyadmin1”
'Dim strSql As String=“插入地图(纬度、经度、服务器日期、地址、地点、国家、用户ID、WEB条目)值(“+sLatitude.ToString+”、“+sLongitude.ToString+”、getdate()、“+sAddress.Replace(”、““”)+”、“+sLocality.Replace(“、”)+”、“+scontry.Replace(“、”、“、”)+”、“+sUserId+”、0)”
“康涅狄格州公开赛”
'Dim cmd作为新的SqlCommand
'cmd.Connection=conn
'cmd.CommandText=strSql
'cmd.CommandType=CommandType.Text
'cmd.ExecuteNonQuery()
“返回真值
将ioEx捕获为IO.IOException
'在此处处理其他非特定IO异常。
抛出新异常(ioEx.Message.ToString)
返回strquery
'返回ioEx.Message.ToString
特例
'在此处处理任何其他非IO异常。
抛出新异常(例如Message.ToString)
返回strquery
'返回ex.Message.ToString
结束尝试
端函数
我的Android代码调用Web服务

private String sendLocation(String latitude, String longitude, String sAddress, String sLocality, String sCountry, String sUserId)
    {
/*      final String NAMESPACE = "http://tempuri.org/";
        final String URL = "http://10.0.2.2:25722/NewLocationMap/Service.asmx";
        final String SOAP_ACTION = "http://tempuri.org/SetLocationForAndroid";
        final String METHOD_NAME = "SetLocationForAndroid";
*/  
        final String NAMESPACE = "http://www.enoxonline.in/";
        final String URL = "http://www.enoxonline.in/webservice.asmx";
        final String SOAP_ACTION = "http://tempuri.org/SetLocationForAndroid";
        final String METHOD_NAME = "SetLocationForAndroid";     

        try
        {
            SoapObject request = new SoapObject (NAMESPACE, METHOD_NAME);
            PropertyInfo pi = new PropertyInfo();
            pi.setType(String.class);
            pi.setName("Latitude");
            pi.setValue(latitude);
            request.addProperty(pi);
//          request.addProperty("Latitude",latitude);
            pi = new PropertyInfo();
            pi.setType(String.class);
            pi.setName("Longitude");
            pi.setValue(longitude);
            request.addProperty(pi);
//          request.addProperty("Longitude", longitude);
            pi = new PropertyInfo();
            pi.setType(String.class);
            pi.setName("sAddress");
            pi.setValue(sAddress);
            request.addProperty(pi);
//          request.addProperty("Longitude", longitude);
            pi = new PropertyInfo();
            pi.setType(String.class);
            pi.setName("sLocality");
            pi.setValue(sLocality);
            request.addProperty(pi);
//          request.addProperty("Longitude", longitude);
            pi = new PropertyInfo();
            pi.setType(String.class);
            pi.setName("sCountry");
            pi.setValue(sCountry);
            request.addProperty(pi);
//          request.addProperty("Longitude", longitude);
            pi = new PropertyInfo();
            pi.setType(String.class);
            pi.setName("sUserId");
            pi.setValue(sUserId);
            request.addProperty(pi);
//          request.addProperty("sUserId", UserId);


            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            envelope.dotNet=true;
            envelope.xsd = NAMESPACE;
            envelope.enc = "http://schemas.datacontract.org/2004/07/Entity";
            envelope.setAddAdornments(false);
            envelope.implicitTypes = true;
            envelope.setOutputSoapObject(request);
            System.out.println(request);

            HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
            androidHttpTransport.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
            androidHttpTransport.call(SOAP_ACTION, envelope);
            return envelope.getResponse().toString();
        }
        catch(Exception ex)
        {
            Log.e("Error : " , "Exception: " + ex.getMessage());
            ex.printStackTrace();
            return ex.getMessage();
        }
    }
私有字符串发送位置(字符串纬度、字符串经度、字符串鞍形、字符串慢度、字符串搜索、字符串sUserId)
{
/*最终字符串名称空间=”http://tempuri.org/";
最终字符串URL=”http://10.0.2.2:25722/NewLocationMap/Service.asmx";
最后一个字符串SOAP_ACTION=”http://tempuri.org/SetLocationForAndroid";
最终字符串方法\u NAME=“SetLocationForAndroid”;
*/  
最终字符串名称空间=”http://www.enoxonline.in/";
最终字符串URL=”http://www.enoxonline.in/webservice.asmx";
最后一个字符串SOAP_ACTION=”http://tempuri.org/SetLocationForAndroid";
最终字符串方法\u NAME=“SetLocationForAndroid”;
尝试
{
SoapObject请求=新的SoapObject(名称空间、方法名称);
PropertyInfo pi=新的PropertyInfo();
pi.setType(String.class);
pi.设置名称(“纬度”);
pi.设定值(纬度);
请求。添加属性(pi);
//请求。添加属性(“纬度”,纬度);
pi=新属性info();
pi.setType(String.class);
pi.setName(“经度”);
pi.设定值(经度);
请求。添加属性(pi);
//addProperty(“经度”,经度);
pi=新属性info();
pi.setType(String.class);
pi.设置名称(“sAddress”);
pi.设定值(鞍形);
请求。添加属性(pi);
//addProperty(“经度”,经度);
pi=新属性info();
pi.setType(String.class);
pi.设置名称(“慢度”);
pi.设定值(慢度);
请求。添加属性(pi);
//addProperty(“经度”,经度);
pi=新属性info();
pi.setType(String.class);
pi.设置名称(“Scontry”);
pi.设定值(斯孔特里);
请求。添加属性(pi);
//addProperty(“经度”,经度);
pi=新属性info();
pi.setType(String.class);
pi.setName(“sUserId”);
pi.设定值(sUserId);
请求。添加属性(pi);
//addProperty(“sUserId”,UserId);
SoapSerializationEnvelope=新的SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet=true;
envelope.xsd=名称空间;