ResponseHandler 无法在 Android 的 SOAP Web 服务中工作?

发布于 2024-12-22 16:01:50 字数 720 浏览 0 评论 0原文

我添加了来自 此链接< /a> 适用于 Android 的 SOAP Web 服务。代码很干净,但 ResponseHandler 的序列不响应任何内容。我还在清单中添加了互联网权限。请帮助我,我添加了下面的代码片段:

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();
    }
};

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();
    }
};

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冷︶言冷语的世界 2024-12-29 16:01:50

声明代码:

ResponseHandler; rh=new ResponseHandler()

根据下面现有的声明进行更改...

 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();  
        } ; 

希望可以帮助^_^ cmiiw ..

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文