开发者

error while running the web services in android

I am trying to access the web services using android in eclipse helios. The program has no errors but as soon as I run the program a dialog box pops up and says, An internal error has occurred. Clicking the details it says java.lang.nullpointerexception. But the logcat has nothing and don't know where the null pointer exception is occuring? Help! this is the screen shot.

Here's the code:

package chandeep.xhance.webservice;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;

import com.test.android.R;


import android.app.Activity;

import android.widget.*;


import android.os.Bundle;


public class AndroidWSAccessActivity extends Activity {

    private static final String NAMESPACE = "com.service.ServiceImpl";
    private static final String URL = 
        "http://192.168.202.124:9000/AndroidWS/wsdl/ServiceImpl.wsdl";  
    private static final String SOAP_ACTION = "ServiceImpl";
    private static final String METHOD_NAME = "message";

    private static final String[] sampleACTV = new String[] {
    "android", "iphone", "blackberry"
    };

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        ArrayAdapter<String> arrAdapt开发者_Python百科er = new ArrayAdapter<String>
        (this, android.R.layout.simple_dropdown_item_1line, sampleACTV);

        AutoCompleteTextView ACTV = (AutoCompleteTextView)findViewById
                        (R.id.AutoCompleteTextView01);
        ACTV.setAdapter(arrAdapter);

        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);        
        SoapSerializationEnvelope envelope = 
            new SoapSerializationEnvelope(SoapEnvelope.VER11); 

        envelope.setOutputSoapObject(request);
        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

        try {
            androidHttpTransport.call(SOAP_ACTION, envelope);
            SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
            ACTV.setHint("Received :" + resultsRequestSOAP.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}  
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜