Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
548 views
in Technique[技术] by (71.8m points)

android - xmlpullparserexception expected: START_TAG

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.........

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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?)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...