简单的android和ASP.NET混合 - java

我编写了一个将文本数据发送到asp.net Web服务器的android应用程序。我正在使用下一个代码通过Http发送数据:

try {
    URL url = new URL(serverUrl);
    connection = (HttpURLConnection)url.openConnection();
    connection.setDoInput(true);
    connection.setDoOutput(true);
    connection.setUseCaches(false);

    // Enable POST method
    connection.setRequestMethod("POST");

    connection.setRequestProperty("Connection", "Keep-Alive");
    connection.setRequestProperty("Content-Type", "text/plain; charset=utf-8");
    output = new DataOutputStream(connection.getOutputStream());
    String finalUri = sendedUrl.replace("gaburl", "");
    output.writeChars(finalUri);
    //Toast.makeText(context, finalUri, 1000).show();
    output.flush();
    output.close();
}
catch(Exception e) {
    Toast.makeText(context, e.toString(), 5);
}

如何在ASP.NET应用程序中通过output.writeChars(finalUri)方法接收和显示数据发送?这个过程应该像下面描述的那样执行:

1)我们有asp.net表单,它是发送者的android方法的目标。

2)表单应该读取发送给它的字符串数据并显示它。

请帮助

参考方案

Using Ksoap2 library and write .net web service 
Sucessful Connection with Asp.net Webservice-----
package ProductVerificationCard.in;

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

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class AdminLogin extends Activity {
    /** Called when the activity is first created. */
    Button btn_ok;
    TextView textView;
    private static final String SOAP_ACTION = "http://tempuri.org/Login";

    private static final String OPERATION_NAME = "Login";

    private static final String WSDL_TARGET_NAMESPACE = "http://tempuri.org/";

    private static final String SOAP_ADDRESS = "http://10.0.2.2/new/WebService.asmx";
    String s;


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        btn_ok=(Button) findViewById(R.id.btn_login);
        textView=(TextView) findViewById(R.id.tv_error);

        btn_ok.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,
                        OPERATION_NAME);

                        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                        SoapEnvelope.VER11);
                        envelope.dotNet = true;

                        envelope.setOutputSoapObject(request);

                        HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);

                        try

                        {

                        httpTransport.call(SOAP_ACTION, envelope);

                        Object response = envelope.getResponse();

                        //textView.setText(response.toString());
                         s=response.toString();
                         if(s=="true")
                         {
                             Intent intent=new Intent(AdminLogin.this,MenuForm.class);
                                startActivity(intent);

                         }

                         else
                         {
                             textView.setText("Enter Valid Username or Password");
                         }
                        }

                        catch (Exception exception)

                        {

                        textView.setText(exception.toString());

                        }
                // TODO Auto-generated method stub
                }
        });

    }
}

JAVA:字节码和二进制有什么区别? - java

java字节代码(已编译的语言,也称为目标代码)与机器代码(当前计算机的本机代码)之间有什么区别?我读过一些书,他们将字节码称为二进制指令,但我不知道为什么。 参考方案 字节码是独立于平台的,在Windows中运行的编译器编译的字节码仍将在linux / unix / mac中运行。机器代码是特定于平台的,如果在Windows x86中编译,则它将仅在Win…

java:继承 - java

有哪些替代继承的方法? java大神给出的解决方案 有效的Java:偏重于继承而不是继承。 (这实际上也来自“四人帮”)。他提出的理由是,如果扩展类未明确设计为继承,则继承会引起很多不正常的副作用。例如,对super.someMethod()的任何调用都可以引导您通过未知代码的意外路径。取而代之的是,持有对本来应该扩展的类的引用,然后委托给它。这是与Eric…

Java:BigInteger,如何通过OutputStream编写它 - java

我想将BigInteger写入文件。做这个的最好方式是什么。当然,我想从输入流中读取(使用程序,而不是人工)。我必须使用ObjectOutputStream还是有更好的方法?目的是使用尽可能少的字节。谢谢马丁 参考方案 Java序列化(ObjectOutputStream / ObjectInputStream)是将对象序列化为八位字节序列的一种通用方法。但…

Java Double与BigDecimal - java

我正在查看一些使用双精度变量来存储(360-359.9998779296875)结果为0.0001220703125的代码。 double变量将其存储为-1.220703125E-4。当我使用BigDecimal时,其存储为0.0001220703125。为什么将它双重存储为-1.220703125E-4? 参考方案 我不会在这里提及精度问题,而只会提及数字…

Java-如何将此字符串转换为日期? - java

我从服务器收到此消息,我不明白T和Z的含义,2012-08-24T09:59:59Z将此字符串转换为Date对象的正确SimpleDateFormat模式是什么? java大神给出的解决方案 这是ISO 8601标准。您可以使用SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy-MM…