我的网络服务代码出现问题。使用代码我将用户凭据传递给服务器,但在服务器端显示空字段的日志文件我无法理解问题,因为我是webservices的新手。我正在使用ksoap,wsdl作为我的webservices
非常感谢任何帮助......
这是代码
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();
}
}
}
答案 0 :(得分:0)
为此你应该得到一份查尔斯 - http://www.charlesproxy.com/
您可以将其配置为充当反向代理,然后如果您将Web服务代码对准反向代理,您将能够检查从手机流向服务器的流量。我在另一个主题中概述了整个过程。
Android to Drupal cookie transfer Q2
如果您需要帮助,请告诉我。