Android:参数传递问题(webservices)

时间:2011-06-17 09:09:06

标签: android web-services

我是网络服务的新手,我在 logcat 中遇到了响应问题。我将所有参数传递给服务器,但响应是一些不可靠的反应,我为了找到解决方案而烦恼不已,但我不能。我在我的webservices中使用 Ksoap,WSDL

logcat消息是这个

 06-17 14:20:31.168: VERBOSE/TAG(302): `RegisterUserResponse{RegisterUserResult=-1; }`
有人帮助我解决这个问题

private static final String SOAP_ACTION = "http://tempuri.org/RegisterUser";
private static final String METHOD_NAME = "RegisterUser";
private static final String NAMESPACE = "http://tempuri.org";
private static final String URL = "http://........";
private static final String TAG = "HELLO";

Thread t;
ProgressDialog dialog;


@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Button signin = (Button) findViewById(R.id.regsubmitbtn);

    signin.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            showDialog(0);
            t = new Thread() {
                public void run() {
                    register();
                }
            };
            t.start();
        }
    });
}

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case 0: {
        dialog = new ProgressDialog(this);
        dialog.setMessage("Please wait while connecting...");
        dialog.setIndeterminate(true);
        dialog.setCancelable(true);
        return dialog;
    }
Button regmalebtn;

public void register() {
    Log.v(TAG, "Trying to Login");

SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(
            SoapEnvelope.VER11);

    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
    soapEnvelope.dotNet = true;

    soapEnvelope.setOutputSoapObject(request);

    // String response1 = request.getProperty(0).toString() ;
    request.addProperty("fname", "raghav");
    request.addProperty("lname", "raju");
    request.addProperty("dateofbirth", "18-01-1985");
    request.addProperty("email", "raghuraju90@yahoo.com");
    request.addProperty("password", "1234");
    //request.addProperty("password", repassword);
    request.addProperty("mobno", "8553456260");
    request.addProperty("latitude", "76");
    request.addProperty("longitude", "82");
    request.addProperty("device_id", "123456");
    request.addProperty("gender", "male");
    // request.addProperty("latitude',latitude);

    HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
    androidHttpTransport.debug = true;
    try {
        androidHttpTransport.call(SOAP_ACTION, soapEnvelope);
        androidHttpTransport
                .setXmlVersionTag("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

        SoapObject resultsRequestSOAP = (SoapObject) soapEnvelope.bodyIn;
        // SoapObject result = (SoapObject) soapEnvelope.getResponse();

        Log.v("TAG", String.valueOf(resultsRequestSOAP));
        String resultData;
        resultData = request.getProperty(0).toString();
    }
    return null;
}
} catch (Exception e) {

        e.printStackTrace();
    }

}
}

1 个答案:

答案 0 :(得分:1)

服务器正在生成该错误。您需要与服务器的开发人员/所有者交谈,让他们检查他们的日志以确定您的交易失败的原因。