我是学生和新的 android 我有一个 Web 服务(WFC C#),当我在 Visual Winform 中测试时它没问题.. 我的 android 代码:
String NAMESPACE="http://tempuri.org/";
String METHOD_NAME="Hello"; // method public string Hello() [WCF]
String SOAP_ACTIONS=NAMESPACE+"/"+METHOD_NAME;
String URL="http://localhost:8732/BookInformationHost/BookService/"; // host Service
SoapObject request=new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet=true;
envelope.encodingStyle=SoapSerializationEnvelope.ENC;
envelope.setOutputSoapObject(request);
HttpTransportSE transp=new HttpTransportSE(URL);
try
{
Toast.makeText(getApplicationContext(), "Try 1", Toast.LENGTH_SHORT).show();
transp.call(SOAP_ACTIONS, envelope);
Toast.makeText(getApplicationContext(), "Try 2", Toast.LENGTH_SHORT).show();
Object result=(Object)envelope;
Toast.makeText(getApplicationContext(), result.toString(), Toast.LENGTH_SHORT).show();
}catch(Exception ex)
{
Toast.makeText(getApplicationContext(), "Hello_Error", Toast.LENGTH_SHORT).show();
}
吐司秀(“Try 1”)和“Hello_Error”。那么我需要做什么才能从 Webservice 上的函数 String 获取 String .. 非常感谢!!!!!!