I have the same problem.
So, if someone has clue or solution...
that will be nice to share it :)


On 1 sep, 16:50, Vp <[EMAIL PROTECTED]> wrote:
> Hi,
> I tired all above mentioned options of settinghttp-proxy and adding
> permissions in AndroidManifest.xml file but still I am not able to
> clear the proxy as well as I am facing following errors:
>
> 09-01 20:13:59.645: ERROR/GpsLocationProvider(54): Could not open GPS
> configuration file /etc/gps.conf
>
> 09-01 20:14:08.245: WARN/System.err(151):
> java.net.UnknownHostException: Host is unresolved:www.google.com:80
>
> Am missing out something or I need to add any other option?
>
> Thanks in advance,
> Vp
>
> On Aug 22, 11:59 pm, "Megha Joshi" <[EMAIL PROTECTED]> wrote:
>
> > Did you try configuring emulator proxy connection as discussed 
> > below:http://groups.google.com/group/android-developers/browse_thread/threa...
>
> > On Fri, Aug 22, 2008 at 1:51 AM, Graeme <[EMAIL PROTECTED]> wrote:
>
> > > hi sacoskun
>
> > > Thanks for your suggestion. Yes I had not set the INTERNET permission
> > > in my
> > > AndroidManifest.xml. I have updated that now and the socket exception
> > > has changed
> > > to being about being unable to resolve the domain name of ahttpproxy
> > > server
> > > I am located behind. I have noticed other threads wherehttp-proxy
> > > usage has been
> > > problematic.
>
> > > Thanks for your tip.
> > > Best Regards
> > > Graeme
>
> > > On Aug 22, 7:30 am, sacoskun <[EMAIL PROTECTED]> wrote:
> > > > Did you add <uses-permission
> > > > android:name="android.permission.INTERNET" /> tag to your
> > > > AndroidManifest.xml?
> > > > The new SDK requires that permission for network calls.
>
> > > > sacoskun
>
> > > > On Aug 21, 6:13 pm, Graeme <[EMAIL PROTECTED]> wrote:
>
> > > > > Hi everyone
>
> > > > > I'm trying to figure out how to use HttpClient 4.x to do POST requests
> > > > > routed via
> > > > > a Proxy server. I'm seeing a socket exception triggered by calling
>
> > > > > DefaultHttpClient.execute(HttpHost target, HttpRequest method). My
> > > > > HttpPoster class looks like
>
> > > > > package com.bt.gcto.android.testhttp;
>
> > > > > import java.io.IOException;
> > > > > import java.util.Hashtable;
>
> > > > > import org.apache.http.Header;
> > > > > import org.apache.http.HttpEntity;
> > > > > import org.apache.http.HttpHost;
> > > > > import org.apache.http.HttpResponse;
> > > > > import org.apache.http.HttpVersion;
> > > > > import org.apache.http.client.HttpClient;
> > > > > import org.apache.http.client.methods.HttpPost;
> > > > > import org.apache.http.conn.ClientConnectionManager;
> > > > > import org.apache.http.conn.params.ConnRoutePNames;
> > > > > import org.apache.http.conn.scheme.PlainSocketFactory;
> > > > > import org.apache.http.conn.scheme.Scheme;
> > > > > import org.apache.http.conn.scheme.SchemeRegistry;
> > > > > import org.apache.http.conn.scheme.SocketFactory;
> > > > > import org.apache.http.conn.ssl.SSLSocketFactory;
> > > > > import org.apache.http.impl.client.DefaultHttpClient;
> > > > > import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
> > > > > import org.apache.http.params.BasicHttpParams;
> > > > > import org.apache.http.params.HttpParams;
> > > > > import org.apache.http.params.HttpProtocolParams;
> > > > > import org.apache.http.util.EntityUtils;
>
> > > > > import android.net.Uri;
> > > > > import android.util.Log;
>
> > > > > public class HttpPoster {
> > > > >        private final String TAG="HttpPoster";
> > > > >            private final String NETWORK_DEVICE_SIDE_TRUE =
> > > > > ";deviceside=true";
> > > > >            private final String NETWORK_DEVICE_SIDE_FALSE =
> > > > > ";deviceside=false";
> > > > >            private final String NETWORK_WIFI = ";interface=wifi";
> > > > >            //private final String proxy="proxy.intra.bt.com:8080";
> > > > >            private boolean useWifi;
> > > > >            private boolean deviceSide;
> > > > >            // Apache HttpClient 4.x stuff
> > > > >            private static HttpParams defaultParameters = null;
> > > > >            private static SchemeRegistry supportedSchemes = null;
>
> > > > >            /**
> > > > >              * Performs general setup.
> > > > >              * This should be called only once.
> > > > >              */
> > > > >             private final static void setup() {
>
> > > > >                 supportedSchemes = new SchemeRegistry();
>
> > > > >                 // Register the "http" and "https" protocol schemes,
> > > they are
> > > > >                 // required by the default operator to look up socket
> > > > > factories.
> > > > >                 SocketFactory sf =
> > > PlainSocketFactory.getSocketFactory();
> > > > >                 supportedSchemes.register(new Scheme("http", sf,80));
> > > > >                 sf = SSLSocketFactory.getSocketFactory();
> > > > >                 supportedSchemes.register(new Scheme("https", sf,80));
>
> > > > >                 // prepare parameters
> > > > >                 HttpParams params = new BasicHttpParams();
> > > > >                 HttpProtocolParams.setVersion(params,
> > > HttpVersion.HTTP_1_1);
> > > > >                 HttpProtocolParams.setContentCharset(params, "UTF-8");
> > > > >                 HttpProtocolParams.setUseExpectContinue(params, true);
> > > > >                 defaultParameters = params;
>
> > > > >             } // setup
>
> > > > >             private final static HttpParams getParams() {
> > > > >                 return defaultParameters;
> > > > >             }
>
> > > > >            HttpPoster(boolean deviceSide, boolean useWifi) {
> > > > >                this.useWifi = useWifi;
> > > > >                this.deviceSide = deviceSide;
> > > > >                System.err.println("HttpPoster::HttpPoster");
> > > > >            }
>
> > > > >            public String post(String url,
>
> > > Hashtable<String,String> headerProperties, byte[] bytes )
> > > > >               throws IOException {
> > > > >                     HttpClient client = null;
> > > > >                     HttpPost method=null;
> > > > >                 //InputStream is = null;
> > > > >                 //OutputStream os = null;
> > > > >                 //String response = "";
> > > > >                 HttpResponse rsp = null;
> > > > >                 HttpEntity entity=null;
> > > > >                 String fullUrl;
> > > > >                 //int rc;
>
> > > > >                 Log.d(TAG,"post() ---ENTER---");
> > > > >                 Log.d(TAG,"HttpPoster::post");
> > > > >                 Log.d(TAG,"http.proxyHost = " +
> > > > > System.getProperty("http.proxyHost"));
> > > > >                 Log.d(TAG,"http.proxyPort = " +
> > > > > System.getProperty("http.proxyPort"));
> > > > >                 try {
> > > > >                     fullUrl = url + (deviceSide ?
> > > NETWORK_DEVICE_SIDE_TRUE :
> > > > > NETWORK_DEVICE_SIDE_FALSE)
> > > > >                      + (useWifi ? NETWORK_WIFI : "");
> > > > >                     Uri fullUri = Uri.parse( fullUrl );
> > > > >                     String targetname = fullUri.getHost();
> > > > >                     Log.d(TAG,"HttpPoster::post -- about to open
> > > connection
> > > > > on URL = " + fullUrl);
> > > > >                     //
> > > > >                     // setup proxy server
> > > > >                     //
> > > > >                         final HttpHost target = new
> > > HttpHost(targetname,80,
> > > > > "http");
> > > > >                         final HttpHost proxy  = new HttpHost("
> > > proxy.mycompany.com",
> > > > > 8080, "http");
>
> > > > >                         setup() ; // Some general setup
> > > > >                         client = new DefaultHttpClient() ;
>
> > > > > client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
>
> > > > >                         method = new HttpPost( fullUrl );
> > > > >                         Log.d(TAG,"Executing request to " + target + "
> > > via " +
> > > > > proxy);
> > > > >                         rsp = client.execute(target, method);
> > > > >                         entity = rsp.getEntity();
>
> > > Log.d(TAG,"---------------------------------------------");
> > > > >                         Log.d(TAG, rsp.getStatusLine().toString() );
> > > > >                         Header [] headers = rsp.getAllHeaders();
> > > > >                         for (int i=0; i<headers.length; i++) {
> > > > >                                 Log.d(TAG,"\t" + headers[i] );
> > > > >                         }
>
> > > Log.d(TAG,"---------------------------------------------");
>
> > > > >                         if (rsp.getEntity() != null) {
> > > > >                                 Log.d(TAG, EntityUtils.toString(
> > > rsp.getEntity() ) );
> > > > >                         }
> > > > >                 } finally {
> > > > >                         if (entity != null)
> > > > >                                 entity.consumeContent(); // release
> > > connection gracefully
> > > > >                 }
> > > > >                 // return response;
> > > > >                 Log.d(TAG,"post() ---EXIT---");
> > > > >                 return new String("");
> > > > >             }
>
> > > > >            private final static HttpClient createHttpClient() {
>
> > > > >                 ClientConnectionManager ccm =
> > > > >                     new ThreadSafeClientConnManager(getParams(),
> > > > > supportedSchemes);
> > > > >                 //  new SingleClientConnManager(getParams(),
> > > > > supportedSchemes);
>
> > > > >                 DefaultHttpClient dhc =
> > > > >                     new DefaultHttpClient(ccm, getParams());
>
> > > > >                 return dhc;
> > > > >             }
>
> > > > >         }
>
> > > > > My TestHttp application launches an Activity TestHttp::onCreate()
> > > > > method  whose DDMS logcat output is
>
> > > > > 08-21 14:25:54.189: DEBUG/TestHttp(238): onCreate()---enter---
> > > > > 08-21 14:25:54.248: DEBUG/TestHttp(238): httpClient is non-null
> > > > > 08-21 14:25:54.398: DEBUG/TestHttp(238): in catch {} response is null
> > > > > 08-21 14:25:54.418: ERROR/TestHttp(238): Error
> > > > > 08-21 14:25:54.418: ERROR/TestHttp(238): java.net.SocketException:
> > > > > unknown
>
> ...
>
> plus de détails »

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to