Ksoap2 を使用して asp.net サービスに接続しましたが、正常に接続されていますが、XML で応答が返されることが 1 つあります。とにかく、通常のテキストで表示することができますか。
これは私が使用したコードです
public class AndroidWebService extends Activity {
/** Called when the activity is first created. */
private static String SOAP_ACTION = "http://tempuri.org/GetHelpDeskCalls";
private static String NAMESPACE = "http://tempuri.org/";
private static String METHOD_NAME = "GetHelpDeskCalls";
static final String URL = "https://198.125.364:8080/AndroidServices/Service1.asmx";
Button getData;
EditText userID;
TextView data;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.helpdesk);
getData = (Button) findViewById(R.id.button1);
userID = (EditText) findViewById(R.id.txtFar);
data = (TextView) findViewById(R.id.textView1);
Thread nT = new Thread() {
@Override
public void run() {
getData.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SoapObject request = new SoapObject(NAMESPACE,
METHOD_NAME);
request.addProperty("userID", userID.getText()
.toString());
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
try {
HttpTransportSE androidHttpTransport = new HttpTransportSE(
URL);
// androidHttpTransport.call(SOAP_ACTION, envelope);
androidHttpTransport.debug = true;
androidHttpTransport.call(SOAP_ACTION, envelope);
final String ss = androidHttpTransport.responseDump;
// final SoapObject response = (SoapObject) envelope
// .getResponse();
runOnUiThread(new Runnable() {
public void run() {
data.setText(ss.toString());
}
});
} catch (Exception e) {
data.setText("Error");
}
}
});
}
};
nT.start();
}
}