后面的Andr​​oid代理KSOAP超时 [英] ksoap timeout behind proxy in android

查看:136
本文介绍了后面的Andr​​oid代理KSOAP超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从的http://www.helloandroid.com/tutorials/using-ksoap2-android-and-parsing-output-data得到请求和响应从WSDL服务。它工作正常,当我试图在proxyless。但是当我的工作背后的代理,我得到的操作超时:请求时失败:产生java.net.SocketException有没有什么办法来设置代理SoapObject或肥皂信封?

i tried the example from http://www.helloandroid.com/tutorials/using-ksoap2-android-and-parsing-output-data to get request and response from a wsdl service. its working fine when i tried in a proxyless. but when i work behind proxy,i get "The operation timed out:request time failed: java.net.SocketException" is there any way to set proxy to SoapObject or Soap Envelop?

推荐答案

KSOAP不使用代理工作。序作出这样的工作.. 下载HttpTransportSE.java和ServiceConnectionSE.java从SourceForge。

Ksoap does not work behind a proxy. inorder to make that working.. download the HttpTransportSE.java and ServiceConnectionSE.java from sourceforge.

与HttpTransportSE和ServiceConnectionSE创建一个包。

Create a package with HttpTransportSE and ServiceConnectionSE.

在ServiceConnectionSE构造:

In ServiceConnectionSE constructor:

 String myProxy=android.net.Proxy.getDefaultHost() ;
            int myPort=android.net.Proxy.getDefaultPort();

            if(myProxy!=null){
                Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(myProxy, myPort));
                connection = (HttpURLConnection) new URL(url).openConnection(proxy);
            }
            else
            {
                connection = (HttpURLConnection) new URL(url).openConnection();
            }

现在的地方,我们称之为HttpTransportSE.call()方法,确保它指向UR自己的包里面有这两个文件。

now wherever we call HttpTransportSE.call()method make sure that it points to ur own package which has this two files.

这篇关于后面的Andr​​oid代理KSOAP超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆