public class WebServiceTest extends Activity {
private static final String Name_Space = "http://tempuri.org/";
private static final String Method_Name = "HelloWorld";
private static final String URL = "http://190.160.10.79:7890/WebService1.asmx";
private static final String Soap_Action = "http://tempuri.org/HelloWorld";
private SoapObject rpc = null;
private HttpTransportSE ht = null;
private SoapSerializationEnvelope envelope = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
this.setContentView(R.layout.webservice_test);
Button btn = (Button)this.findViewById(R.id.myButton);
btn.setOnClickListener(new Button.OnClickListener(){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
new Thread(){
public void run()
{
try
{
rpc = new SoapObject(Name_Space, Method_Name);
}
catch(Exception e)
{
Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show();
}
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = rpc;
envelope.dotNet = true;
envelope.setOutputSoapObject(rpc);
ht = new HttpTransportSE(URL);
ht.debug = true;
try
{
//调用webservice方法
ht.call(Soap_Action, envelope);
//返回webservice值
SoapObject detail = (SoapObject)envelope.getResponse();到这里报错,为什么呢?
Toast.makeText(getApplicationContext(), detail.toString(), Toast.LENGTH_LONG).show();
}
catch (IOException e)
{
e.printStackTrace();
}
catch (XmlPullParserException e)
{
e.printStackTrace();
}
}
}.start();
}
});
}
报什么错?