为什么Soap Response会给出异常?

时间:2012-05-04 07:23:22

标签: android ksoap2

我发送SOAP requestURL中附加一些值但是没有任何响应即将发生异常我正在使用以下代码 -                                         我有更多的尝试,但没有成功,请看到它并给我一些指导,我错了?

   SharedPreferences myPrefs = this.getSharedPreferences("myPrefs",
            MODE_WORLD_READABLE);
     String prefName = myPrefs.getString(MY_ID, "0");
    // http://dotnet4.peaceofmind.in/ms/ChestMeetAndMeet  /ChestMeetAndMeatServices.asmx
    final String SOAP_ACTION = "http://dotnet4.peaceofmind.in/ms/ChestMeetAndMeet/ChestMeetAndMeatServices.asmx/UpdateUserProfile";
    final String OPERATION_NAME ="UpdateUserProfile";
    final String WSDL_TARGET_NAMESPACE ="http://dotnet4.peaceofmind.in/ms/ChestMeetAndMeet/";

    final String SOAP_ADDRESS ="http://dotnet4.peaceofmind.in/ms/ChestMeetAndMeet/ChestMeetAndMeatServices.asmx";
    SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME);

    //PropertyInfo pi = new PropertyInfo();
    request.addProperty("sUserId", prefName);

    request.addProperty("sUserName", prefName);
    request.addProperty("sUserId", getfirstname);
    request.addProperty("sPassword", "");
    request.addProperty("sFirstName",getfirstname);
    request.addProperty("sLastName", "");
    request.addProperty("sAlternateEmailId",getemail);
    request.addProperty("sBirthDate",getbirthdate);
    request.addProperty("sAddress1", getaddress1);
    request.addProperty("sOpenTo", getopento);
    request.addProperty("sCity", getcity);
    request.addProperty("sState", getstate);
    request.addProperty("sCountry", getcountry);
    request.addProperty("sZipCode", getzip);
    request.addProperty("sMobile", getmobile);
    request.addProperty("sPhone", "");
    request.addProperty("sInterest", getinterest);
    request.addProperty("sLatitude","");
    request.addProperty("sLongitude", "");
    request.addProperty("sProfession", getprofession);
    request.addProperty("sHeight", getheight);
    request.addProperty("sWeight", getweight);
    request.addProperty("sColor", getethinicity);
    request.addProperty("sProfileImage", bitmapString);
    request.addProperty("sGender", "");
    request.addProperty("sMaritalStatus",getmaritalstatus);
    request.addProperty("sShortDescription", getlookingfor);
    request.addProperty("sCheckInLocation", "");

    SoapSerializationEnvelope envelope = new       SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.dotNet = true;
    envelope.setOutputSoapObject(request);

HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);
     try
        {
         SoapObject response=null;
            httpTransport.call(SOAP_ACTION,envelope);
            try{
                    //give exception bellow line
             response = (SoapObject)envelope.getResponse();
            }catch(Exception e)
            {
                System.out.println(e.getMessage());
                e.printStackTrace();
            }
            int  UserID=  Integer.parseInt(response.toString());
            objprofile.ResultValue=  response.getProperty(1).toString();
           int vv = objprofile.UserID;
           String rre= objprofile.ResultValue;


        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
}

请任何人帮助我                        以下是Exception显示 -

        05-04 13:06:41.859: W/System.err(11790): SoapFault - faultcode: 'soap:Client'     faultstring: 'System.Web.Services.Protocols.SoapException: Server did not recognize the   value of HTTP Header SOAPAction: http://dotnet4.peaceofmind.in/ms/ChestMeetAndMeet /ChestMeetAndMeatServices.asmx/UpdateUserProfile.
       05-04 13:06:41.859: W/System.err(11790):    at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
      05-04 13:06:41.869: W/System.err(11790):    at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)
       05-04 13:06:41.869: W/System.err(11790):    at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
      05-04 13:06:41.869: W/System.err(11790):    at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context,    HttpRequest request, HttpResponse response, Boolean& abortProcessing)' faultactor: 'null' detail: org.kxml2.kdom.Node@406236e0
     05-04 13:06:41.889: W/System.err(11790):   at org.ksoap2.serialization.SoapSerializationEnvelope.parseBody(SoapSerializationEnvelope.java:116)
     05-04 13:06:41.889: W/System.err(11790):   at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:137)
   05-04 13:06:41.909: W/System.err(11790):     at org.ksoap2.transport.Transport.parseResponse(Transport.java:63)
   05-04 13:06:41.919: W/System.err(11790):     at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:100)
   05-04 13:06:41.929: W/System.err(11790):     at com.synapse.meetnmeat.MyProfile.userIdREsponse(MyProfile.java:735)
   05-04 13:06:41.929: W/System.err(11790):     at com.synapse.meetnmeat.MyProfile.UpdateUserProfile(MyProfile.java:358)
   05-04 13:06:41.929: W/System.err(11790):     at     com.synapse.meetnmeat.MyProfile$7$1.run(MyProfile.java:271)

1 个答案:

答案 0 :(得分:0)

在异常中,您可以看到地址字符串包含空格: http://dotnet4.peaceofmind.in/ms/ChestMeetAndMeet HEREYOUHAVESPACE /ChestMeetAndMeatServices.asmx/UpdateUserProfile 这是无效的网址