日志文件在服务器端显示空字段

发布于 2024-11-15 18:13:48 字数 3042 浏览 1 评论 0原文

我的网络服务代码有问题。使用代码,我将用户凭据传递到服务器,但在服务器端日志文件显示空字段时,我无法理解问题,因为我是网络服务新手。我正在使用 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", "[email protected]");
    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();
    }

}
}

i got a problem with my web services code. with the code I am passing the user credentials to server, but at the server side log file showing empty fields I cant understand the problem as I am new to webservices. I am using ksoap ,wsdl for my webservices

Any help would be greatly appreciated...

this is the code

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", "[email protected]");
    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();
    }

}
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

太阳男子 2024-11-22 18:13:48

为此,您应该获取 Charles 的副本 - http://www.charlesproxy.com/

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

Android 到 Drupal cookie 传输 Q2

如果您需要帮助,请联系我知道。

For this you should get a copy of Charles - http://www.charlesproxy.com/

You can configure it to act as a reverse proxy and then if you aim your web service code at the reverse proxy you'll be able to inspect the traffic flowing from your phone to the server. I've outlined the whole process in another thread.

Android to Drupal cookie transfer Q2

If you need help let me know.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文