Karthik
Karthik

Reputation: 5033

ResponseHandler not working in SOAP Web services for android?

I have added a code from this link for SOAP Web services for android. The code is clean but the sequence for ResponseHandler doesnt respond to anything.I have added Internet permission in the manifest also. Please help me on this I have added the snippet below:

ResponseHandler<String> rh=new ResponseHandler<String>() {

    // invoked when client receives response  
    public String handleResponse(HttpResponse response) throws ClientProtocolException, IOException {
        HttpEntity entity = response.getEntity();
        StringBuffer out = new StringBuffer();
        byte[] b = EntityUtils.toByteArray(entity);

        out.append(new String(b, 0, b.length));
        return out.toString();
    }
};

Upvotes: 0

Views: 510

Answers (1)

fajarhide
fajarhide

Reputation: 58

Statement code :

ResponseHandler<String> rh=new ResponseHandler<String>()

change according to the existing statement below ...

 ResponseHandler<String> responseHandler = new BasicResponseHandler();
                        String response = httprespons.execute(httpentity, responseHandler);
        try {  
            HttpEntity entity = response.getEntity();

                           StringBuffer out = new StringBuffer();
                           byte[] b = EntityUtils.toByteArray(entity);

                           out.append(new String(b, 0, b.length));
                           return out.toString();

        } catch (ClientProtocolException e) {  
            e.printStackTrace();  
        } catch (IOException e) {  
            e.printStackTrace();  
        } ; 

hopefully can help ^_^ cmiiw ..

Upvotes: 1

Related Questions