2

这是我的网络服务。我只想获取名称。但是当我运行我的应用程序时出现错误。

java.lang.NoClassDefFoundError:org.ksoap2.serilization.soapobject 在我的包名

public static String SOAP_ACTION1 = "http://tempuri.org/GetContact";

   // private static String SOAP_ACTION2 = "http://tempuri.org/CelsiusToFahrenheit";

public static String NAMESPACE = "http://tempuri.org/";

public static String METHOD_NAME1 = "GetContact";

//private static String METHOD_NAME2 = "CelsiusToFahrenheit";

private static String URL = "http://115.119.182.114/Rotaryclub/RotaryService.asmx"; 

TextView txt;
//ListView lv;
@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);

    setContentView(R.layout.displaycontacts);

    txt=(TextView) findViewById(R.id.textView11);





      //CALL the web service method with the two parameters vname and nname

        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME1);

        request.addProperty( "Cid","1");
        request.addProperty("Position", "doctor");
        request.addProperty("Name", "abhishek");
        request.addProperty("ImageUrl", "test.jpg");
        request.addProperty("PhoneNo", "4324434323");
        request.addProperty("MobileNo", "4324434323");
        request.addProperty("FaxNo", "43-434-34");
        request.addProperty("EmailId", "abh22ishek@gmail.com");
        request.addProperty("Address", "kalkere");



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

        // Make the soap call.
        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
        try {

            //this is the actual part that will call the webservice
            androidHttpTransport.call(SOAP_ACTION1, envelope);        
        } catch (Exception e) {
            e.printStackTrace(); 
        }

        // Get the SoapResult from the envelope body.       
        SoapObject result = (SoapObject)envelope.bodyIn;
       // SoapPrimitive result = (SoapPrimitive)envelope.getResponse();
       // String strRes = result.toString();


        if(result != null){

            txt.setText("SOAP response:\n\n" + result.getProperty(2).toString());
        }
4

0 回答 0