android–org.xmlpull.v1.XmlPullParserException:expected:START_TAG {http:schemas.xmlsoap.orgsoa

android–org.xmlpull.v1.XmlPullParserException:expected:START_TAG {http:schemas.xmlsoap.orgsoa,第1张

概述你好我在webservice这里新建我正在使用SOAP服务并在localhost上运行但是收到此错误这是我的代码:publicclassNeteeshextendsActivity{privatestaticfinalStringURL="http://localhost:7642/Service1.asmx";privatestaticfinalStringNAMESPACE="http:/empuri.o

你好我在webservice这里新建我正在使用SOAP服务并在localhost上运行但是收到此错误这是我的代码:public class Neteesh extends Activity {

private static final String URL = "http://localhost:7642/Service1.asmx";private static final String nameSPACE = "http://tempuri.org/";private static final String METHOD_name = "HelloWorld";private static final String SOAP_ACTION = "http://tempuri.org/HelloWorld";public voID onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);TextVIEw textVIEw = new TextVIEw(this);setContentVIEw(textVIEw);new LongOperation().execute("");}private class LongOperation extends AsyncTask<String, VoID, String> {    @OverrIDe    protected String doInBackground(String... HelloWorldResult)     {        // Todo auto-generated method stub        String value = new String();        System.out.println("InsIDe getLognoperation method...........");        SoapObject request = new SoapObject(nameSPACE, METHOD_name);        request.addProperty("billID", HelloWorldResult);        SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);        soapEnvelope.dotNet=true;        soapEnvelope.setoutputSoapObject(request);        AndroIDhttpTransport androIDhttpTransport = new AndroIDhttpTransport(URL);        try        {            androIDhttpTransport.call(SOAP_ACTION, soapEnvelope);            SoapPrimitive  resultString = (SoapPrimitive)soapEnvelope.getResponse();            value = resultString.toString();            System.out.println("This getAccountsnames xmls is : "+value);        }   catch (Exception e) {            e.@R_301_1715@ ();        }        return value;    }           }   }

这是我的logcat:

  11-16 11:11:48.371: W/System.err(1324): org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <HTML>@2:7 in java.io.inputStreamReader@4101fc30) 11-16 11:11:48.371: W/System.err(1324):     at org.kxml2.io.KXmlParser.require(KXmlParser.java:2046)11-16 11:11:48.371: W/System.err(1324):     at org.ksoap2.soapEnvelope.parse(SoapEnvelope.java:127)11-16 11:11:48.381: W/System.err(1324):     at org.ksoap2.transport.Transport.parseResponse(Transport.java:63)11-16 11:11:48.381: W/System.err(1324):     at org.ksoap2.transport.httpTransportSE.call(httpTransportSE.java:100)11-16 11:11:48.381: W/System.err(1324):     at com.example.helloworlDWebservice.Neteesh$LongOperation.doInBackground(Neteesh.java:55)11-16 11:11:48.381: W/System.err(1324):     at com.example.helloworlDWebservice.Neteesh$LongOperation.doInBackground(Neteesh.java:1)11-16 11:11:48.381: W/System.err(1324):     at androID.os.AsyncTask.call(AsyncTask.java:287)11-16 11:11:48.381: W/System.err(1324):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)11-16 11:11:48.391: W/System.err(1324):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)11-16 11:11:48.391: W/System.err(1324):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)11-16 11:11:48.404: W/System.err(1324):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)11-16 11:11:48.404: W/System.err(1324):     at java.lang.Thread.run(Thread.java:856)11-16 11:11:48.404: W/System.err(1324): [ 11-16 11:11:48.404  1324: 1337 I/expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG Exception

如果我的结构错误,请编辑问题,如何解决它.我需要在webservice中的字符串响应.请提前帮助谢谢..

解决方法:

由于AndroID模拟器在虚拟机上运行,​​因此您必须使用它

private static final String URL = "http://10.0.2.2:7642/Service1.asmx";

代替

private static final String URL = "http://localhost:7642/Service1.asmx";

接着

protected String doInBackground(String... HelloWorldResult)     {      .....      SoapObject request = new SoapObject(nameSPACE, METHOD_name);      request.addProperty("billID", HelloWorldResult[0]);      .....  }

你现在正在尝试……

总结

以上是内存溢出为你收集整理的android – org.xmlpull.v1.XmlPullParserException:expected:START_TAG {http://schemas.xmlsoap.org/soa全部内容,希望文章能够帮你解决android – org.xmlpull.v1.XmlPullParserException:expected:START_TAG {http://schemas.xmlsoap.org/soa所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1096103.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存