【问题标题】:Android exception org.xmlpull.v1.XmlPullParserException: expected: START_TAG <html>Android 异常 org.xmlpull.v1.XmlPullParserException:预期:START_TAG <html>
【发布时间】:2013-02-18 17:33:20
【问题描述】:

我一直在尝试使用一个 .NET 网络服务(首先测试的 HelloWorld 方法),使用几乎与另一个网络服务相同的代码。

public class MainActivity extends Activity {

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

    private static final String METHOD_NAME = "HelloWorld";

    private static final String NAMESPACE = "http://tempuri.org/";
    private static final String URL = "http://demo.digiparc.com/autocomplete.asmx";

    private static final String TAG = "MyActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        TextView tv = (TextView)findViewById(R.id.textView1);


        SoapObject Request = new SoapObject(NAMESPACE,METHOD_NAME);

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

        HttpTransportSE aht = new HttpTransportSE(URL);

        try{

            aht.call(SOAP_ACTION,envelope);
            Log.i(TAG, "ind");
            SoapPrimitive resultString = (SoapPrimitive)envelope.getResponse();
            System.out.println("Result: "+resultString);
            tv.setText("Status : " + resultString);

        }
        catch(Exception e){
            Log.i(TAG, e.toString());
            e.printStackTrace();
        }

    }

我的第一个日志没有出现在 logcat 中,第二个日志我发现了以下异常:

org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <html>@1:6 in java.io.InputStreamReader@45f9a950) 

我做错了吗?如果有人遇到同样的问题或有任何线索可以提供帮助吗?我的 Web 服务详细信息是准确的。

【问题讨论】:

    标签: android web-services exception android-ksoap2 xmlpullparser


    【解决方案1】:

    这不是 android 或 WebService 的问题。
    APPCODE 中可能有一个 app_html.offline 不允许它在线运行。
    转到 C# 中的解决方案资源管理器。
    右键单击并将其从项目中排除。 :D

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-18
      • 1970-01-01
      相关资源
      最近更新 更多