0
我一直在嘗試使用一個.NET webservice(HelloWorld方法來測試第一個),使用實際上相同的代碼爲另一個webservice工作。Android異常org.xmlpull.v1.XmlPullParserException:預期:START_TAG <html>
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 [email protected])
我做錯什麼了嗎?如果有誰面臨同樣的問題或有任何線索可以幫助?我的Web服務細節是確切的。