sierho
Mar 18th 2004, 7:58 am
I am a beginner in googleapi programing.when run a java programe,i got such
default information:
{com.google.soap.search.GoogleSearchFault: [SOAPException: faultCode=SOAP-ENV:Pro
tocol; msg=Unsupported response content type "text/html", must be: "text/xml". R
esponse was:
<html><body><div align="center"><table border="1" cellpadding="0" cellspacing="0
" width="400" bordercolordark="#C9E5B9" bordercolorlight="#C9E5B9"><tr><td bgcol
or="#C9E5B9" width="598"><p><font color="#000000" size="5">?????ó?§×??????????
í????</font></p></td></tr><tr><td align="center"><font size="4" color="#ff0000">
?ú??</font><form method="POST" action="http://gate3.sdu.edu.cn/memcgi/zhuce"><p>
?? ?§ ????<input type="text" name="username" size="13"></p><p>??????????<input
type="password" name="password" size="13"></p><p>×??ó???±??<input type="text"
name="timeout" size="8" value="30">(·???)</p><p><input type="submit" value="×?
?á" name="B1"></p><input type="hidden" name="url" value="http://216.239.51.104">
</form></td></tr></table></div><p align="center"><font color="#000000">×???????
???í????v4.2 2004?ê3??.</font></p></body></html>
]
at com.google.soap.search.GoogleSearch.doGetCachedPage(GoogleSearch.java
:233)
at goglcache.main(goglcache.java:14)}
what's wrong with my programe,what should i do to correct it?
And my programe is as follwing:
import com.google.soap.search.*;
import java.io.*;
public class goglcache
{
public static void main(String[] args)
{
try
{
GoogleSearch search=new GoogleSearch();
String clientKey = "C37Rqx5QFHLQQd7KCTsw2DcjakPA3e4e";
search.setKey(clientKey);
search.setOutputEncoding("GB2312");
byte[] pageText=search.doGetCachedPage(args[0]);
System.out.println(new String(pageText));
}
catch(GoogleSearchFault e)
{
e.printStackTrace();
}
catch(ArrayIndexOutOfBoundsException e)
{
System.out.println("Usage: java GoogleCacheDemo url");
}
}
}
default information:
{com.google.soap.search.GoogleSearchFault: [SOAPException: faultCode=SOAP-ENV:Pro
tocol; msg=Unsupported response content type "text/html", must be: "text/xml". R
esponse was:
<html><body><div align="center"><table border="1" cellpadding="0" cellspacing="0
" width="400" bordercolordark="#C9E5B9" bordercolorlight="#C9E5B9"><tr><td bgcol
or="#C9E5B9" width="598"><p><font color="#000000" size="5">?????ó?§×??????????
í????</font></p></td></tr><tr><td align="center"><font size="4" color="#ff0000">
?ú??</font><form method="POST" action="http://gate3.sdu.edu.cn/memcgi/zhuce"><p>
?? ?§ ????<input type="text" name="username" size="13"></p><p>??????????<input
type="password" name="password" size="13"></p><p>×??ó???±??<input type="text"
name="timeout" size="8" value="30">(·???)</p><p><input type="submit" value="×?
?á" name="B1"></p><input type="hidden" name="url" value="http://216.239.51.104">
</form></td></tr></table></div><p align="center"><font color="#000000">×???????
???í????v4.2 2004?ê3??.</font></p></body></html>
]
at com.google.soap.search.GoogleSearch.doGetCachedPage(GoogleSearch.java
:233)
at goglcache.main(goglcache.java:14)}
what's wrong with my programe,what should i do to correct it?
And my programe is as follwing:
import com.google.soap.search.*;
import java.io.*;
public class goglcache
{
public static void main(String[] args)
{
try
{
GoogleSearch search=new GoogleSearch();
String clientKey = "C37Rqx5QFHLQQd7KCTsw2DcjakPA3e4e";
search.setKey(clientKey);
search.setOutputEncoding("GB2312");
byte[] pageText=search.doGetCachedPage(args[0]);
System.out.println(new String(pageText));
}
catch(GoogleSearchFault e)
{
e.printStackTrace();
}
catch(ArrayIndexOutOfBoundsException e)
{
System.out.println("Usage: java GoogleCacheDemo url");
}
}
}