首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

Android中调用Webservice是出错,大侠们知道错在哪里吗?该怎么处理

2012-02-03 
Android中调用Webservice是出错,大侠们知道错在哪里吗?WSUtils类代码:Java codepackage com.dai.hellowsi

Android中调用Webservice是出错,大侠们知道错在哪里吗?
WSUtils类代码:

Java code
package com.dai.hellows;import java.io.IOException;import org.ksoap2.SoapEnvelope;import org.ksoap2.serialization.MarshalBase64;import org.ksoap2.serialization.SoapObject;import org.ksoap2.serialization.SoapSerializationEnvelope;import org.ksoap2.transport.HttpTransportSE;import org.xmlpull.v1.XmlPullParserException;public class WSUtils {    public static String getMessage(){        String message="";        //命名空间        String namespace="http://tempuri.org/";        //请求URL        String serviceURL="http://www.zhichengtz.com/WebService.asmx";        //要调用的方法名        String methodName="HelloWorld";                SoapObject request=new SoapObject(namespace,methodName);        SoapSerializationEnvelope envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);        envelope.bodyOut=request;        (new MarshalBase64()).register(envelope);                HttpTransportSE ht=new HttpTransportSE(serviceURL);        ht.debug=true;        try {            ht.call("http://tempuri.org/HelloWorld", envelope);            if(envelope.getResponse()!=null){                message=envelope.bodyIn.toString();            }        } catch (IOException e) {            // TODO Auto-generated catch block            e.printStackTrace();        } catch (XmlPullParserException e) {            // TODO Auto-generated catch block            e.printStackTrace();        }                        return message;    }        }


HelloWSActivity类代码:
Java code
package com.dai.hellows;import android.app.Activity;import android.os.Bundle;import android.widget.TextView;public class HelloWSActivity extends Activity {        private TextView helloTV;        /** Called when the activity is first created. */    @Override    public void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.main);        helloTV=(TextView)findViewById(R.id.helloTV);        String message=WSUtils.getMessage();        System.out.println("message="+message);        helloTV.setText(message);    }}




[解决办法]
这个不是你的错误吧,是服务器端的错误,C:\WINDOWS\TEMP\0zirsksq.0.cs 服务器端没有这个文件

热点排行