Here is my code....
public void getAuthentification() {
System.out.println("check");
//HttpPost post = new HttpPost("
https://www.google.com/accounts/
ClientLogin");
try {
System.getProperties().put("proxySet", true);
System.getProperties().put("proxyHost","proxyMY" );
System.getProperties().put("proxyPort","8080");
System.out.println("getAuthentication method
called****************************");
URL url=new URL("
https://www.google.com/accounts/ClientLogin");
URLConnection connection=url.openConnection();
connection.setDoOutput(true);
HttpURLConnection conn=(HttpURLConnection)connection;
BufferedWriter out = new BufferedWriter( new
OutputStreamWriter( conn.getOutputStream() ) );
out.write("Email=
x...@gmail.com\r\n");
out.write("Passwd=12345\r\n");
out.write("accountType=GOOGLE\r\n");
out.write("source=MY_APP-V0.1\r\n");
out.write("service=ac2dm\r\n");
System.out.println("here");
BufferedReader rd = new BufferedReader(new
InputStreamReader(conn.getInputStream()));
System.out.println("getAuthentication method called2");
String line = "";
while ((line = rd.readLine()) != null) {
System.out.println(line);
System.out.println("inside");
if (line.startsWith("Auth=")) {
key=line.substring(5);
System.out.println(line.substring(5));
System.out.println("something to be done here..");
}
}
}
catch(IOException e) {
e.printStackTrace();
}
}
}
Getting this error:::
java.io.IOException: Server returned HTTP response code: 403 for URL:
https://www.google.com/accounts/ClientLogin
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:
1290)
at
sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:
234)
at
com.tcs.mobility.android.c2dm.Server.getAuthentification(Server.java:
75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:
397)
at
org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:
186)
at
org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:
323)
at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:
32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:
454)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:
699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:
327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
293)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
849)
at org.apache.coyote.http11.Http11Protocol
$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:
454)
at java.lang.Thread.run(Thread.java:619)
.
.
.
.
.
some one please help..
Thanks in advance....