0

我的网络服务代码有问题。使用代码我将用户凭据传递给服务器,但在服务器端日志文件显示空字段我无法理解问题,因为我是 web 服务的新手。我正在为我的网络服务使用 ksoap 、wsdl

任何帮助将不胜感激...

这是代码

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 register = (Button) findViewById(R.id.regsubmitbtn);

    register.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();
    }

}
}
4

1 回答 1

0

为此,您应该获得一份 Charles - http://www.charlesproxy.com/

您可以将其配置为反向代理,然后如果您将 Web 服务代码对准反向代理,您将能够检查从手机流向服务器的流量。我已经在另一个线程中概述了整个过程。

Android 到 Drupal cookie 传输 Q2

如果您需要帮助,请告诉我。

于 2011-06-17T19:05:43.103 回答