xmlpullparserexception expected: START_TAG

佐手、 提交于 2019-11-28 02:02:55

问题


I have the following:

public String searchRecipes( String searchString, int pageNumber ) throws Exception
    {
        SoapObject _client = new SoapObject( "", "searchRecipes" );
        _client.addProperty("searchString", searchString);
        _client.addProperty("pageNumber",   pageNumber);

        SoapSerializationEnvelope _envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11 );
        _envelope.bodyOut = _client;

        Marshal dateMarshal = new MarshalDate();
        dateMarshal.register(_envelope);

        HttpTransportSE _ht = new HttpTransportSE(Configuration.getWsUrl());
        _ht.call("", _envelope);

        return  _envelope.getResponse().toString();
    }

It works fine when I use it on my local server on the PC using the eclipse. But when I deploy it I get:

expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <html>@1:6 in java.io.InputStreamReader@4056fb48) 

Can anybody help? I am facing it for more than a week.........


回答1:


Well, I think NAMESPACE string should be the first argument in SoapObject constructor. The same for the call() method (here should be NAMESPACE + METHOD_NAME as the first parameter)

And try this:

_envelope.setOutputSoapObject(_client);

instead of this:

_envelope.bodyOut = _client;

To get the response: it depends on what your web service is returning (a primitive or complex object?)



来源:https://stackoverflow.com/questions/8288356/xmlpullparserexception-expected-start-tag

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!