Using Google apis
Hi All,
I don't whether it is right place to post this question, but would like to know that has anyone used Google adWords api?
I am trying to develop an application using Google adWords apis and sandbox utility. But my application is throwing following exception.
Exception in thread "main" javax.xml.rpc.ServiceException: java.lang.ClassCastException: com.google.api.adwords.v10.CampaignServiceSoapBindingStub
please help me out.
Thanks in advance.
Santosh,
Sorry but you have posted to a forum that deals exclusively with questions/issues about Microsoft Project, a planning and scheduling application. I suggest you delete this post and find a more appropriate forum.
John
Similar Messages
-
How streaming an audio or video files from google drive using google api objective-c client?
I have implemented streaming an audio or video files by mpmovieplayer from Dropbox. For this purpose I am using Dropbox sdk. Audio or video files are playing with no problem from dropbox in my app.
But, I can not implement the same functionality from Google drive. I am using alternateLink,webcontentLink,EmbedLink,Exportlink that we get from google drive. But mpmovieplayer does not play audio or video. So how can get any link from google drive,by which i can streaming an audio or video file from google drive. I have listed all google drive files in a table view. I am using google api objective-c client. So please help me. Thanks in advance.Hello,
I'm giving a try at your application and so far, it is great!
I understand that you're working on a way to help moving back files to google drive. Actually, I can copy / paste, but it always renames the files, so I end up with both a "copy of" and my original file.
could you save and overwite the original file when it already exists ? (perhaps an option in the settings) ?
Thanks! -
How to use Google API for Visual Studio Application using Google Drive
I am creating an VB 2010 Form that will collect data and then automate sharing to select individuals. Right now I am storing the data in the Google Drive folder on the Desktop but some people that may be using this application may not have Google Drive downloaded
on their desktop so I would like to know if there is another way to add the data files (Excel files) to Google Drive. I would also like to have my application automatically share the files with select individuals and possibly publish onto Google+ or at
least create a notification on Google+ that a new file has been added to the Drive. Thanks in advance for ANY help that anyone can offer!Hello,
Thank you for your post.
I am afraid that the issue is out of support range of VS General Question forum which mainly discusses
the usage of Visual Studio IDE such as WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System
and Visual Studio Editor.
Because you use Google Drive and Google API which are third-party, I suggest consult on its support forum/community provided by its publisher.
IN addition, about Visual Basic programming, please consult on Visual Basic forum:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vbgeneral for better response.
Best regards,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Need to Use google APIs in View .htm Page
Hi Experts,
I have the following requirements:
I need to capture the Geo code based on the user click from Google maps and update the same in the CRM.
I need to load the Google maps with multiple Location Marking and Marking Icons will be changing based on some condition.
I had implemented the Mash-ups to Load Google Maps in the WEB UI screen.
I found that Mash-ups will be helpful only to load the web Page Via URL(parameters passing) and it will not return back any info.
So i created a custom view and write the Java Script logic which contain the Google APIs,functions to load the Maps dynamically with
multiple Geocodes Etc., How ever while am loading the view in the CRM am not able to load the maps.
So I create a Page with Flow Logic in the same BSP Component and i provide the same code which i given in View's .htm page,while testing its working fine.
Q1 > Using Mashups in CRM can use the Google APIS and can we raise events on click on the Maps?
Q2> Why Java Scripts contain Google APIS are not loading in the View's .htm page like Pages with flow Logic.
Q3> How can i Load the Page with flow Logic in the View's .htm page with out using Iframe?
Any Suggestion will be helpful.
Thanks and Regards,
Y. Ravi Kumar.Hi,
I just wanted to post some of my experience on java.nio.channels.FileLock.
If a file is in use by an application, for example if a jar file is launched, the file is obviously locked by the system in a way we can't delete it.
However it is still considered as unlocked by java as an exclusive FileLock could be set.
If an exclusive FileLock has been set on a file no other exclusive FileLock could be set by any other application. (relieved ! the basic lock operation works !)
When a FileLock is set on a jar file it DEFINITELY corrupt the considered jar !!!!!
the message "Invalid or corrupt jarfile" is displayed when I try to execute it using java
and any zip utility can't open it any more.
And it is not a locking problem !
Even after the exit of the application that lock the file, release of the lock, copy of the considered jar, the jarfile is definitely corrupted.
I guess it could/should be the same thing on other file types.
What an awful bug :(
My config is Windows Vista sp1
java version "1.6.0_05"
Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
Java HotSpot(TM) Client VM (build 10.0-b19, mixed mode, sharing)
Considering the question "if I then use a FileLock and lock my file, can I still delete it?"
The answer is no you can't delete it:
You can't delete it with the application that locked it
(not even with File.deleteOnExit() method -- still with the above config --)
neither with another application.
Of course you can release the lock and delete it ... -
[errorCode: BEA-380000] Proxy service using Google API
Hi sirs,
I testing following this blogs : http://www.yenlo.nl/danielpalstra/2011/03/03/using-osb-with-rest/
There's 4 step but i'm stucking at step 2
1. Authenticate using API ClientLogin authentication with your Google username (email) and password
2. Retrieve “auth” token from the ClientLogin response
Link of API CLientLogin is : https://www.google.com/accounts/ClientLogin
When i try with my raw data i can get response data:
====================================================================
POST /accounts/ClientLogin HTTP/1.0
Content-type: application/x-www-form-urlencoded
accountType=HOSTED_OR_GOOGLE&Email=********@gmail.com&Passwd=********&service=cp&
source=Gulp-CalGulp-1.05
========================================================================
HTTP/1.0 200 OK
Content-Type: text/plain
Cache-control: no-cache, no-store
Pragma: no-cache
Expires: Mon, 01-Jan-1990 00:00:00 GMT
Date: Mon, 14 Nov 2011 08:18:48 GMT
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Content-Length: 818
Server: GSE
SID=DQAAALwAAADVw2Zd7RVeOJmUh6NtAtbS90djGyM6ij09lUjSJ0KqT2A85mj3doG1OoU26Mxu_PNqIDiur1kMbZuj_XrB3-jzj4OO4lNCWpmYuy_nw0exfmNGQXiySUZ5Z_97Wv-2MRDDfg_uDv6zB7bVctLJIXAXVgQBjab2_pFvqNW_K2Qdp_n24a0PMWQkEBEQei3SPAGD1A8Xi4WXM50bRstc72nQfFGX39FOhmd_t8TUc-IS2Qclsi0zU09CgEnVAqbCN6w
LSID=DQAAAL0AAABmYroXC57jIYKR9aa_nBDrNYNLG6rizYuczrCLzpIIBRSDm4tm46Ms9pbOPNhVZJwxoS4SX7ouJ_otU-6DIUGZOXWgzHRjjPTC24kWlry0VPN6NI4d-8IsLtFh-wJ3ZlJ8dGbsyD1NDXGnBgFWhymsMXJRNfq4EjXR45rbvu1F2zX-tejL1yKp9v2v2zCFLL-boqbjclG3qnzigpsOIpp9Em4K5psf-IfVbnOjE3YZQcG4LxALoQnyuQE8673bU
Auth=DQAAAL4AAABmYroXC57jIYKR9aa_nBDrNYNLG6rizYuczrCLzpIIBRSDm4tm46Ms9pbOPNhVZJw-nvtu5YEz5Ktw5C8744GoquGHpcHWSfabCsVUtXH6bPDJ7n7tee5Ub79FfWfGmJIKtCEXkSwFfyv5SrKEr4ZqLxsvyv-SISZXlilOKqNHKWqei27NIvBIrQOLCd5MqTILQRmfZOP0rOvkoCqTt5I2hyFyhevWeYuayn06QD0DPqpLFdYiaoNsxI70Rcte4
====================================================================
When i create proxy service and business service as the guide. I got a fault like this:
$fault:
<con:fault xmlns:con="http://www.bea.com/wli/sb/context">
<con:errorCode>BEA-380000</con:errorCode>
<con:reason>Found</con:reason>
<con:location>
<con:node>RouteNode1</con:node>
<con:path>response-pipeline</con:path>
</con:location>
</con:fault>
This is whole Invocation Trace
(receiving request)
Initial Message Context
added $body
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"/>
added $header
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"/>
added $inbound
<con:endpoint name="ProxyService$google$getGoogleAuth" xmlns:con="http://www.bea.com/wli/sb/context">
<con:service/>
<con:transport>
<con:uri>/google/getGoogleAuth</con:uri>
<con:mode>request-response</con:mode>
<con:qualityOfService>best-effort</con:qualityOfService>
<con:request xsi:type="http:HttpRequestMetaData" xmlns:http="http://www.bea.com/wli/sb/transports/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tran:headers xsi:type="http:HttpRequestHeaders" xmlns:tran="http://www.bea.com/wli/sb/transports">
<http:Content-Type>text/plain; charset=utf-8</http:Content-Type>
</tran:headers>
<tran:encoding xmlns:tran="http://www.bea.com/wli/sb/transports">utf-8</tran:encoding>
<http:query-string>username=*******&password=*******</http:query-string>
<http:query-parameters/>
</con:request>
<con:response xsi:type="http:HttpResponseMetaData" xmlns:http="http://www.bea.com/wli/sb/transports/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tran:headers xsi:type="http:HttpResponseHeaders" xmlns:tran="http://www.bea.com/wli/sb/transports">
<http:Content-Type>text/plain</http:Content-Type>
</tran:headers>
<tran:response-code xmlns:tran="http://www.bea.com/wli/sb/transports">0</tran:response-code>
</con:response>
</con:transport>
<con:security>
<con:transportClient>
<con:username><anonymous></con:username>
</con:transportClient>
</con:security>
</con:endpoint>
added $messageID
1417705043541984180-569da6b1.133c91b1102.-7fde
RouteNode1
Routed Service
Route to: "googleLogin"
$outbound:
<con:endpoint name="BusinessService$google$googleLogin" xmlns:con="http://www.bea.com/wli/sb/context">
<con:service/>
<con:transport>
<con:mode>request-response</con:mode>
<con:qualityOfService>best-effort</con:qualityOfService>
<con:request xsi:type="http:HttpRequestMetaData" xmlns:http="http://www.bea.com/wli/sb/transports/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tran:headers xsi:type="http:HttpRequestHeaders" xmlns:tran="http://www.bea.com/wli/sb/transports">
<http:Content-Type>application/x-www-form-urlencoded</http:Content-Type>
</tran:headers>
</con:request>
</con:transport>
<con:security>
<con:doOutboundWss>false</con:doOutboundWss>
</con:security>
</con:endpoint>
$body (request):
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
accountType=HOSTED_OR_GOOGLE&Email=********@gmail.com&Passwd=********&service=cp&source=Appname
</soapenv:Body>
$header (request):
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"/>
$attachments (request):
<con:attachments xmlns:con="http://www.bea.com/wli/sb/context"/>
Message Context Changes
added $queryString
username=********&password=***********
added $username
added $outbound
<con:endpoint name="BusinessService$google$googleLogin" xmlns:con="http://www.bea.com/wli/sb/context">
<con:service/>
<con:transport>
<con:uri>
https://www.google.com/accouts/clientLogin
</con:uri>
<con:mode>request-response</con:mode>
<con:qualityOfService>best-effort</con:qualityOfService>
<con:request xsi:type="http:HttpRequestMetaData" xmlns:http="http://www.bea.com/wli/sb/transports/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tran:headers xsi:type="http:HttpRequestHeaders" xmlns:tran="http://www.bea.com/wli/sb/transports">
<http:Content-Type>
application/x-www-form-urlencoded; charset=utf-8
</http:Content-Type>
</tran:headers>
<tran:encoding xmlns:tran="http://www.bea.com/wli/sb/transports">utf-8</tran:encoding>
</con:request>
<con:response xsi:type="http:HttpResponseMetaData" xmlns:http="http://www.bea.com/wli/sb/transports/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tran:headers xsi:type="http:HttpResponseHeaders" xmlns:tran="http://www.bea.com/wli/sb/transports">
<http:Cache-Control>private</http:Cache-Control>
<http:Connection>close</http:Connection>
<http:Content-Length>218</http:Content-Length>
<http:Content-Type>text/html; charset=UTF-8</http:Content-Type>
<http:Date>Tue, 22 Nov 2011 04:11:02 GMT</http:Date>
<http:Location>http://www.google.com</http:Location>
<http:Server>GFE/2.0</http:Server>
</tran:headers>
<tran:response-code xmlns:tran="http://www.bea.com/wli/sb/transports">1</tran:response-code>
<tran:response-message xmlns:tran="http://www.bea.com/wli/sb/transports">Found</tran:response-message>
<tran:encoding xmlns:tran="http://www.bea.com/wli/sb/transports">UTF-8</tran:encoding>
<http:http-response-code>302</http:http-response-code>
</con:response>
</con:transport>
<con:security>
<con:doOutboundWss>false</con:doOutboundWss>
</con:security>
</con:endpoint>
added $password
changed $body
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"/>
changed $attachments
<con:attachments xmlns:con="http://www.bea.com/wli/sb/context"/>
changed $inbound
<con:endpoint name="ProxyService$google$getGoogleAuth" xmlns:con="http://www.bea.com/wli/sb/context">
<con:service/>
<con:transport>
<con:uri>/google/getGoogleAuth</con:uri>
<con:mode>request-response</con:mode>
<con:qualityOfService>best-effort</con:qualityOfService>
<con:request xsi:type="http:HttpRequestMetaData" xmlns:http="http://www.bea.com/wli/sb/transports/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tran:headers xsi:type="http:HttpRequestHeaders" xmlns:tran="http://www.bea.com/wli/sb/transports">
<http:Content-Type>text/plain; charset=utf-8</http:Content-Type>
</tran:headers>
<tran:encoding xmlns:tran="http://www.bea.com/wli/sb/transports">utf-8</tran:encoding>
<http:query-string>username=**********&password=********</http:query-string>
<http:query-parameters/>
</con:request>
<con:response xsi:type="http:HttpResponseMetaData" xmlns:http="http://www.bea.com/wli/sb/transports/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tran:headers xsi:type="http:HttpResponseHeaders" xmlns:tran="http://www.bea.com/wli/sb/transports">
<http:Content-Type>text/plain</http:Content-Type>
</tran:headers>
<tran:response-code xmlns:tran="http://www.bea.com/wli/sb/transports">0</tran:response-code>
</con:response>
</con:transport>
<con:security>
<con:transportClient>
<con:username><anonymous></con:username>
</con:transportClient>
</con:security>
</con:endpoint>
changed $header
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"/>
System Error Handler
$fault:
<con:fault xmlns:con="http://www.bea.com/wli/sb/context">
<con:errorCode>BEA-380000</con:errorCode>
<con:reason>Found</con:reason>
<con:location>
<con:node>RouteNode1</con:node>
<con:path>response-pipeline</con:path>
</con:location>
</con:fault>
this is the 4 th project i do with OSB so i don't know where to debug this. Please help me to pass this problem. I will very appreciate for ur help.
Edited by: tien86 on 20:28 21-11-2011
Edited by: tien86 on 20:43 21-11-2011What are the operations in your business service?
Are you setting the correct operation in dynamic route expression?
here is an example:
<ctx:route>
<ctx:service isProxy='false'>TestProject/TestFolder/TestBusinessService</ctx:service>
<ctx:operation>BusinessServiceOperationName</ctx:operation>
</ctx:route> -
Hi
I want to get input ZIPCODE from user
and want to get distance from my Location
> user enter zipcode (home town location )
> send data to google maps
>return of distance from user's location to my location
is that possible ?Security.allowInsecureDomain("*");
Security.allowDomain("*");
var mapslink:String = "http://maps.googleapis.com/maps/api/directions/xml?origin=11771&destination=06752&sensor=f alse";
var urlLoader:URLLoader = new URLLoader();
var mapURL:URLRequest = new URLRequest(mapslink);
urlLoader.load(mapURL);
urlLoader.addEventListener(Event.COMPLETE, mapDataLoaded);
urlLoader.addEventListener(IOErrorEvent.IO_ERROR, errorIssue)
var mapXML:XML = new XML();
var timetravel:String;
function mapDataLoaded(event:Event):void
mapXML = XML(urlLoader.data);
timetravel = String(mapXML.route[0].leg[0].duration[0].text) ;
function errorIssue(event:IOErrorEvent):void
trace("event : "+event); -
Usage of Google API for route implementation in the iPhone application
Hi,
We need to show the maps showing some specific locations and the routes from user's current location to these specific locations. We know that Google provides APIs for getting the route between two locations.
Google has some terms and conditions for using their APIs for route. You can find it on the website http://code.google.com/intl/de/apis/maps/iphone/terms.html (point 10.9).
Can anyone please advice if we can use Google APIs in our iPhone application?
Regards,
NileshThis is a user to user help forum for iPhone users, not for app developers with app development questions. As a registered iOS app developer with Apple, you have access to Apple's developer discussions area which is where such a question should be asked.
-
Hi,
I'm newbie to the portal technology and more worked on the EJB side.
My requirement is like this:
I've to display a world map and support the various events like mouse click, mouse hover etc.+
Google API can be used for this.
I've to fetch the data according to the events on the map. The next layer in the application has tight interface with Portal.
<ol><li> How can I display and handle world map events using portal?</li>
<li> If I use GoogleAPI, how should be both GoogleAPI and portal fit together?</li>
</ol>
Thanks in Advance,
Anaghashould be the same as any other mashup. Peter Laird has some entries regarding this
http://www.oracle.com/technology/pub/articles/dev2arch/2007/05/google-mashups2.html (here you'd use bea for your rest service)
and you can also visit
http://wlp.bea.com and click web 2.0
You'd use google api's just as you would in any other HTML page (in this case generated partly by the portlet hosting your code)
regards
deepak -
Google API, inside a cfform
Is it possible to put a Google map (and pointers) created on
the fly using Google API, inside a cfform to be displayed as an
image?
I am using to display my map. <div id="map_canvas"
style="width: 600px; height: 400px"></div>
Running coldfusion 7.
Any help or resources would be greatly appreciated.
Thanksfound the problem. If you qualify the wwctx_api with portal_sso (portal_sso.wwctx_api) instead of portal (portal.wwctx_api) you get the user for the sign on server, which apparently is always public.
-
How do I use doGoogleSearch to connect to Google API
Hello all,
I am trying to do my final year project and I am currently having trouble connecting to the Google API using doGoogleSearch. I dont know how to use http://api.google.com/GoogleSearch.wsdl to fill in the parameters for the doGoogleSearch and then I have to use the http://api.google.com/search/beta2 to connect to Google and perform the test. Any help would be appreciated or code or links
Thanks in advance rgds,
Tony
Here is my code so far...................................
package tony_buckley_project;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.net.URI;
import java.net.URLConnection;
import java.util.*;
import java.io.*;
import org.xml.sax.*;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import com.google.soap.search.GoogleSearch;
import com.google.soap.search.GoogleSearchResult;
import com.google.soap.search.GoogleSearchFault;
import com.google.soap.search.GoogleSearchResultElement;
import com.google.soap.search.*;
import javax.xml.soap.*;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPElement;
import org.apache.soap.util.xml.*;
import org.apache.soap.*;
import org.apache.soap.rpc.*;
import org.w3c.dom.*;
import java.io.FileInputStream;
import javax.xml.transform.stream.StreamSource;
import javax.xml.messaging.URLEndpoint;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.*;
* <p>Title: Mr. Tony Buckley</p>
* <p>Description: </p>
* <p>Copyright: Copyright Tony Buckley (c) 2004</p>
* <p>Company: Cork Institute of Technology </p>
* @[email protected]
* @version 1.0
public class Applet2 extends Frame implements WindowListener , ActionListener
TextField searchField;
Button search , quit;
Canvas0 canvas;
public Applet2()
super();
//Set up basic window
setTitle("Tony Buckley Final Year Project");
setBackground(Color.white);
setSize(500 , 400);
addWindowListener(this);
//Set up area with buttons
//Search button
Panel p1 = new Panel();
p1.setLayout(new FlowLayout());
searchField = new TextField("" , 15);
p1.add(searchField);
search = new Button("Search the web for results...");
p1.add(search);
search.addActionListener(this);
//Quit button
Panel p2 = new Panel();
p2.setLayout(new FlowLayout());
Button quit = new Button("Quit");
p2.add(quit);
quit.addActionListener(this);
//Set up search results area
Canvas0 canvas = new Canvas0();
add("Center" , canvas);
Panel p4 = new Panel();
p4.setLayout(new GridLayout(2 , 1));
p4.add(p1);
p4.add(p2);
add("South" , p4);
}//End of constructor method public Applet2()
public void doGoogleSearch()
String key;
String q;
int start;
int maxResults;
boolean filter;
String restrict;
boolean safeSearch;
String lr;
String ie;
String oe;
public static void main(String[] args)
Applet2 app = new Applet2();
app.setVisible(true);
public void actionPerformed(ActionEvent event)
//Deals with "Quit" button
if(event.getSource() == quit)
dispose();
System.exit(0);
else if(event.getSource() == search)
/* try
String suggestion = search_internet .doSpellingSuggestion(spellingRequest);
if(suggestion == null)
System.out.println("There is no spelling suggestion in the database");
else
System.out.println(suggestion);
int startResult = 100;
search_internet.setStartResult(startResult);
int maxResult = 5;
search_internet.setMaxResults(maxResult);
GoogleSearchResult result_search_internet = search_internet.doSearch();
GoogleSearchResultElement[] resultElements = result_search_internet.getResultElements();
int startIndex = result_search_internet.getStartIndex() - 1 - startResult;
int endIndex = result_search_internet.getEndIndex() - 1 - startResult;
for(int i = startIndex ; i <= endIndex; i ++)
GoogleSearchResultElement resultElement = resultElements[(i)];
String title = resultElement.getTitle();
String URL = resultElement.getURL();
System.out.println(title);
System.out.println(URL);
System.out.println("");
System.out.println("Start Index = " + result_search_internet.getStartIndex());
System.out.println("End Index = " + result_search_internet.getEndIndex());
System.out.println(result_search_internet.toString());
int numResults = result_search_internet.getEstimatedTotalResultsCount();
if(result_search_internet.getEstimateIsExact())
System.out.println("Number of results: " +numResults);
else
System.out.println("Estimated number of results: " +numResults);
//catch(GoogleSearchFault gsf)
// System.out.println("Google Search Fault: " +gsf.getMessage());
try
String myKey = "0RK+HoNQFHJlcbNPfxgBpcjESUWV96aO";
String wsdl = "http://api.google.com/GoogleSearch.wsdl";
String url = "http://api.google.com/search/beta2";
String ns1 = "urn:GoogleSearch";
String searchTerm;
searchTerm = "science fiction";
String spellingRequest = searchTerm;
//First create the connection
SOAPConnectionFactory soapConnFactory = SOAPConnectionFactory.newInstance();
SOAPConnection connection = soapConnFactory.createConnection();
//Create the actual message
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage message = messageFactory.createMessage();
//Create objects for the message parts
SOAPPart soapPart = message.getSOAPPart();
SOAPEnvelope envelope = soapPart.getEnvelope();
SOAPBody body = envelope.getBody();
//Populate the message
SOAPElement bodyElement = body.addChildElement(envelope.createName("doGoogleSearch" , "ns1", ns1));
GoogleSearch search = new GoogleSearch();
search.setKey(myKey);
search.setQueryString(searchTerm);
//Save the message
message.saveChanges();
//Send the message and get a reply
//Set the destination
URLEndpoint destination = new URLEndpoint(url);
//Send the message
SOAPMessage reply = connection.call(message, destination);
SOAPPart sp = reply.getSOAPPart();
SOAPEnvelope se = sp.getEnvelope();
SOAPBody sb = se.getBody();
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
Source sourceContent = reply.getSOAPPart().getContent();
StreamResult result = new StreamResult(System.out);
transformer.transform(sourceContent, result);
//Close the connection
connection.close();
catch(Exception e)
System.out.println(e.getMessage());
}//End of method actionPerformed
public void windowClosing(WindowEvent event)
//Deals with the window closing
dispose();
System.exit(0);
}//End of method windowClosing
public void windowOpened(WindowEvent event)
public void windowIconified(WindowEvent event)
public void windowDeiconified(WindowEvent event)
public void windowClosed(WindowEvent event)
public void windowActivated(WindowEvent event)
public void windowDeactivated(WindowEvent event)
}//End of class Applet2
class Canvas0 extends Canvas
public Canvas0()
super();
public void paint(Graphics g)
Dimension d = getSize();
Font f1 = new Font("TimesRoman" , Font.PLAIN , 14);
Font f2 = new Font("TimesRoman" , Font.ITALIC , 14);
FontMetrics fm1 = g.getFontMetrics(f1);
FontMetrics fm2 = g.getFontMetrics(f2);
String s1 = "Hello , ";
String s2 = "World";
int w1 =fm1.stringWidth(s1);
int w2 =fm1.stringWidth(s2);
g.setColor(Color.GREEN);import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.net.URI;
import java.net.URLConnection;
import java.util.*;
import java.io.*;
import org.xml.sax.*;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import com.google.soap.search.GoogleSearch;
import com.google.soap.search.GoogleSearchResult;
import com.google.soap.search.GoogleSearchFault;
import com.google.soap.search.GoogleSearchResultElement;
import com.google.soap.search.*;
import javax.xml.soap.*;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPElement;
import org.apache.soap.util.xml.*;
import org.apache.soap.*;
import org.apache.soap.rpc.*;
import org.w3c.dom.*;
import java.io.FileInputStream;
import javax.xml.transform.stream.StreamSource;
import javax.xml.messaging.URLEndpoint;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.*;
Title: Mr. Tony Buckley
Description:
Copyright: Copyright Tony Buckley (c) 2004
Company: Cork Institute of Technology
* @[email protected]
http://beingaplayer.x314.co.uk
* @version 1.0
public class Applet2 extends Frame implements WindowListener , ActionListener
TextField searchField;
Button search , quit;
Canvas0 canvas;
public Applet2()
super();
//Set up basic window
setTitle("Tony Buckley Final Year Project");
setBackground(Color.white);
setSize(500 , 400);
addWindowListener(this);
//Set up area with buttons
//Search button
Panel p1 = new Panel();
p1.setLayout(new FlowLayout());
searchField = new TextField("" , 15);
p1.add(searchField);
search = new Button("Search the web for results...");
p1.add(search);
search.addActionListener(this);
//Quit button
Panel p2 = new Panel();
p2.setLayout(new FlowLayout());
Button quit = new Button("Quit");
p2.add(quit);
quit.addActionListener(this);
//Set up search results area
Canvas0 canvas = new Canvas0();
add("Center" , canvas);
Panel p4 = new Panel();
p4.setLayout(new GridLayout(2 , 1));
p4.add(p1);
p4.add(p2);
add("South" , p4);
}//End of constructor method public Applet2()
public void doGoogleSearch()
String key;
String q;
int start;
int maxResults;
boolean filter;
String restrict;
boolean safeSearch;
String lr;
String ie;
String oe;
public static void main(String[] args)
Applet2 app = new Applet2();
app.setVisible(true);
public void actionPerformed(ActionEvent event)
//Deals with "Quit" button
if(event.getSource() == quit)
dispose();
System.exit(0);
else if(event.getSource() == search)
/* try
String suggestion = search_internet .doSpellingSuggestion(spellingRequest);
if(suggestion == null)
System.out.println("There is no spelling suggestion in the database");
else
System.out.println(suggestion);
int startResult = 100;
search_internet.setStartResult(startResult);
int maxResult = 5;
search_internet.setMaxResults(maxResult);
GoogleSearchResult result_search_internet = search_internet.doSearch();
GoogleSearchResultElement[] resultElements = result_search_internet.getResultElements();
int startIndex = result_search_internet.getStartIndex() - 1 - startResult;
int endIndex = result_search_internet.getEndIndex() - 1 - startResult;
for(int i = startIndex ; i <= endIndex; i ++)
GoogleSearchResultElement resultElement = resultElements[(i)];
String title = resultElement.getTitle();
String URL = resultElement.getURL();
System.out.println(title);
System.out.println(URL);
System.out.println("");
System.out.println("Start Index = " + result_search_internet.getStartIndex());
System.out.println("End Index = " + result_search_internet.getEndIndex());
System.out.println(result_search_internet.toString());
int numResults = result_search_internet.getEstimatedTotalResultsCount();
if(result_search_internet.getEstimateIsExact())
System.out.println("Number of results: " +numResults);
else
System.out.println("Estimated number of results: " +numResults);
//catch(GoogleSearchFault gsf)
// System.out.println("Google Search Fault: " +gsf.getMessage());
try
String myKey = "0RK+HoNQFHJlcbNPfxgBpcjESUWV96aO";
String wsdl = "http://api.google.com/GoogleSearch.wsdl";
String url = "http://api.google.com/search/beta2";
String ns1 = "urn:GoogleSearch";
String searchTerm;
searchTerm = "science fiction";
String spellingRequest = searchTerm;
//First create the connection
SOAPConnectionFactory soapConnFactory = SOAPConnectionFactory.newInstance();
SOAPConnection connection = soapConnFactory.createConnection();
//Create the actual message
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage message = messageFactory.createMessage();
//Create objects for the message parts
SOAPPart soapPart = message.getSOAPPart();
SOAPEnvelope envelope = soapPart.getEnvelope();
SOAPBody body = envelope.getBody();
//Populate the message
SOAPElement bodyElement = body.addChildElement(envelope.createName("doGoogleSearch" , "ns1", ns1));
GoogleSearch search = new GoogleSearch();
search.setKey(myKey);
search.setQueryString(searchTerm);
//Save the message
message.saveChanges();
//Send the message and get a reply
//Set the destination
URLEndpoint destination = new URLEndpoint(url);
//Send the message
SOAPMessage reply = connection.call(message, destination);
SOAPPart sp = reply.getSOAPPart();
SOAPEnvelope se = sp.getEnvelope();
SOAPBody sb = se.getBody();
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
Source sourceContent = reply.getSOAPPart().getContent();
StreamResult result = new StreamResult(System.out);
transformer.transform(sourceContent, result);
//Close the connection
connection.close();
catch(Exception e)
System.out.println(e.getMessage());
}//End of method actionPerformed
public void windowClosing(WindowEvent event)
//Deals with the window closing
dispose();
System.exit(0);
}//End of method windowClosing
public void windowOpened(WindowEvent event)
public void windowIconified(WindowEvent event)
public void windowDeiconified(WindowEvent event)
public void windowClosed(WindowEvent event)
public void windowActivated(WindowEvent event)
public void windowDeactivated(WindowEvent event)
}//End of class Applet2
class Canvas0 extends Canvas
public Canvas0()
super();
public void paint(Graphics g)
Dimension d = getSize();
Font f1 = new Font("TimesRoman" , Font.PLAIN , 14);
Font f2 = new Font("TimesRoman" , Font.ITALIC , 14);
FontMetrics fm1 = g.getFontMetrics(f1);
FontMetrics fm2 = g.getFontMetrics(f2);
String s1 = "Hello , ";
String s2 = "World";
int w1 =fm1.stringWidth(s1);
int w2 =fm1.stringWidth(s2);
g.setColor(Color.GREEN); -
One or more errors occurred using google drive api
Hi,
I am trying to use the Google Drive API in my C# application with the below code but getting the following error:
System.AggregateException was unhandled
HResult=-2146233088
Message=One or more errors occurred.
Source=mscorlib
StackTrace:
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at WindowsFormsApplication1.frmMain.btnUpload_Click(Object sender, EventArgs e) in c:\Users\CakeBoutique\Documents\Visual Studio 2012\Projects\WindowsFormsApplication1\WindowsFormsApplication1\main_form.cs:line 35
at System.Windows.Forms.Control.OnClick(EventArgs e)
at DevExpress.XtraEditors.BaseButton.OnClick(EventArgs e)
at DevExpress.XtraEditors.BaseButton.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at DevExpress.Utils.Controls.ControlBase.WndProc(Message& m)
at DevExpress.XtraEditors.BaseControl.WndProc(Message& msg)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at WindowsFormsApplication1.Program.Main() in c:\Users\CakeBoutique\Documents\Visual Studio 2012\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Program.cs:line 26
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.IO.FileNotFoundException
HResult=-2147024894
Message=Could not load file or assembly 'Microsoft.Threading.Tasks.Extensions.Desktop, Version=1.0.16.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Source=Microsoft.Threading.Tasks
FileName=Microsoft.Threading.Tasks.Extensions.Desktop, Version=1.0.16.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
FusionLog==== Pre-bind state information ===
LOG: User = JASSIM-RAHMA\CakeBoutique
LOG: DisplayName = Microsoft.Threading.Tasks.Extensions.Desktop, Version=1.0.16.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
(Fully-specified)
LOG: Appbase = file:///C:/Users/CakeBoutique/documents/visual studio 2012/Projects/WindowsFormsApplication1/WindowsFormsApplication1/bin/Release/
LOG: Initial PrivatePath = NULL
Calling assembly : Google.Apis.Auth.PlatformServices, Version=1.8.1.31699, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\CakeBoutique\documents\visual studio 2012\Projects\WindowsFormsApplication1\WindowsFormsApplication1\bin\Release\WindowsFormsApplication1.vshost.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.Threading.Tasks.Extensions.Desktop, Version=1.0.16.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
LOG: Attempting download of new URL file:///C:/Users/CakeBoutique/documents/visual studio 2012/Projects/WindowsFormsApplication1/WindowsFormsApplication1/bin/Release/Microsoft.Threading.Tasks.Extensions.Desktop.DLL.
LOG: Attempting download of new URL file:///C:/Users/CakeBoutique/documents/visual studio 2012/Projects/WindowsFormsApplication1/WindowsFormsApplication1/bin/Release/Microsoft.Threading.Tasks.Extensions.Desktop/Microsoft.Threading.Tasks.Extensions.Desktop.DLL.
LOG: Attempting download of new URL file:///C:/Users/CakeBoutique/documents/visual studio 2012/Projects/WindowsFormsApplication1/WindowsFormsApplication1/bin/Release/Microsoft.Threading.Tasks.Extensions.Desktop.EXE.
LOG: Attempting download of new URL file:///C:/Users/CakeBoutique/documents/visual studio 2012/Projects/WindowsFormsApplication1/WindowsFormsApplication1/bin/Release/Microsoft.Threading.Tasks.Extensions.Desktop/Microsoft.Threading.Tasks.Extensions.Desktop.EXE.
StackTrace:
at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
at Microsoft.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at Google.Apis.Auth.OAuth2.GoogleWebAuthorizationBroker.<AuthorizeAsync>d__1.MoveNext() in c:\code\google.com\google-api-dotnet-client\default\Tools\Google.Apis.Release\bin\Debug\output\default\Src\GoogleApis.Auth.DotNet4\OAuth2\GoogleWebAuthorizationBroker.cs:line 54
InnerException:
here is the code:
UserCredential credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
new ClientSecrets
ClientId = "xxxxxxxxx",
ClientSecret = "xxxxxxxxx",
new[] { DriveService.Scope.Drive },
"user",
CancellationToken.None).Result;
// Create the service.
var service = new DriveService(new BaseClientService.Initializer()
HttpClientInitializer = credential,
ApplicationName = "Drive API Sample",
File body = new File();
body.Title = "My document";
body.Description = "A test document";
body.MimeType = "text/plain";
byte[] byteArray = System.IO.File.ReadAllBytes("c:\\temp\\mygdriver.txt");
System.IO.MemoryStream stream = new System.IO.MemoryStream(byteArray);
FilesResource.InsertMediaUpload request = service.Files.Insert(body, stream, "text/plain");
request.Upload();
File file = request.ResponseBody;
Console.WriteLine("File id: " + file.Id);
Console.WriteLine("Press Enter to end this process.");
Console.ReadLine();
Kindly advise...Hello,
For issues regarding google APIs, please post it to:
https://developers.google.com/maps/support/
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to use Google weather API in flex?
Hi there,
I have 2 services.
ServiceONE : http://api.locationservice.com/city/key=123abc
ServiceTWO: http://www.google.co.in/ig/api?weather='anyCityName'
I am using HTTPService for both. Firstly I fetch result which gives me city name, by sending ServiceONE. And then, I am assigning this city name to SericeTWO and sending it, which gives me weather details about that city.
I am hosting my applicaition on some server, http://www.somethirdpartyserver.com/myaccount/myflexstuff/MyWeatherApplication.html
Since it tries to access http://api.locationservice.com/city/key=123abc and http://www.google.co.in/ig/api?weather='anyCityName', I would need to have crossdomain.xml in them.
Fortunately I could find http://api.locationservice.com/crossdomain.xml, which has:
<?xml version="1.0" ?>
<!DOCTYPE cross-domain-policy (View Source for full doctype...)>
- <cross-domain-policy>
<site-control permitted-cross-domain-policies="all" />
<allow-access-from domain="*" secure="true" />
<allow-http-request-headers-from domain="*" headers="*" secure="true" />
</cross-domain-policy>
Which mean, any server can access it.
But unfortunately, I couldnot find something similar in http://www.google.co.in/crossdomain.xml. Though xml is there, the code is different:
<?xml version="1.0" ?>
<!DOCTYPE cross-domain-policy (View Source for full doctype...)>
- <cross-domain-policy>
<site-control permitted-cross-domain-policies="by-content-type" />
</cross-domain-policy>
It doesn't allow any access to any domain.....
I've already developed the weather gadget in flex but I cant host it for use anywhere, because of this security issue
Can anyone kindly help me how can this be resolved?>?
-Deepak@ PaulH
Yes, after few more searches I came across php proxy solution. I should have checked about availablity of crossdomain file in the root of the api, which I didn't and started off with the development.
For now I'll use this php proxy and use Google weather api. And yes, as you said, it's not official. Can get changed\removed, which will surely affect my code.
Thanks for http://www.worldweatheronline.com/, may be I'll try to implement it with this api soon and make my app completely stable!
Came across another great api for weather which too has crossdomain! http://www.wunderground.com
I've uploaded the widget right here: http://deepflex.blogspot.com/2011/03/weather-widget.html
@alexsliced
Adobe Flex is a software development kit (SDK) released by Adobe Systems for the development and deployment of cross-platform rich Internet applications based on the Adobe Flash platform. Flex applications can be written using Adobe Flash Builder or by using the freely available Flex compiler from Adobe.
You can find more about it here:
http://flex.org/what-is-flex
http://en.wikipedia.org/wiki/Adobe_Flex -
Need help using doGoogleSearch to connect to Google API
Hello all,
I am trying to do my final year project and I am currently having trouble connecting to the Google API using doGoogleSearch. I dont know how to use http://api.google.com/GoogleSearch.wsdl to fill in the parameters for the doGoogleSearch and then I have to use the http://api.google.com/search/beta2 to connect to Google and perform the test. Any help would be appreciated or code or links
Thanks in advance rgds,
Tony
Here is my code so far...................................
package tony_buckley_project;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.net.URI;
import java.net.URLConnection;
import java.util.*;
import java.io.*;
import org.xml.sax.*;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import com.google.soap.search.GoogleSearch;
import com.google.soap.search.GoogleSearchResult;
import com.google.soap.search.GoogleSearchFault;
import com.google.soap.search.GoogleSearchResultElement;
import com.google.soap.search.*;
import javax.xml.soap.*;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPElement;
import org.apache.soap.util.xml.*;
import org.apache.soap.*;
import org.apache.soap.rpc.*;
import org.w3c.dom.*;
import java.io.FileInputStream;
import javax.xml.transform.stream.StreamSource;
import javax.xml.messaging.URLEndpoint;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.*;
* <p>Title: Mr. Tony Buckley</p>
* <p>Description: </p>
* <p>Copyright: Copyright Tony Buckley (c) 2004</p>
* <p>Company: Cork Institute of Technology </p>
* @[email protected]
* @version 1.0
public class Applet2 extends Frame implements WindowListener , ActionListener
TextField searchField;
Button search , quit;
Canvas0 canvas;
public Applet2()
super();
//Set up basic window
setTitle("Tony Buckley Final Year Project");
setBackground(Color.white);
setSize(500 , 400);
addWindowListener(this);
//Set up area with buttons
//Search button
Panel p1 = new Panel();
p1.setLayout(new FlowLayout());
searchField = new TextField("" , 15);
p1.add(searchField);
search = new Button("Search the web for results...");
p1.add(search);
search.addActionListener(this);
//Quit button
Panel p2 = new Panel();
p2.setLayout(new FlowLayout());
Button quit = new Button("Quit");
p2.add(quit);
quit.addActionListener(this);
//Set up search results area
Canvas0 canvas = new Canvas0();
add("Center" , canvas);
Panel p4 = new Panel();
p4.setLayout(new GridLayout(2 , 1));
p4.add(p1);
p4.add(p2);
add("South" , p4);
}//End of constructor method public Applet2()
public void doGoogleSearch()
String key;
String q;
int start;
int maxResults;
boolean filter;
String restrict;
boolean safeSearch;
String lr;
String ie;
String oe;
public static void main(String[] args)
Applet2 app = new Applet2();
app.setVisible(true);
public void actionPerformed(ActionEvent event)
//Deals with "Quit" button
if(event.getSource() == quit)
dispose();
System.exit(0);
else if(event.getSource() == search)
/* try
String suggestion = search_internet .doSpellingSuggestion(spellingRequest);
if(suggestion == null)
System.out.println("There is no spelling suggestion in the database");
else
System.out.println(suggestion);
int startResult = 100;
search_internet.setStartResult(startResult);
int maxResult = 5;
search_internet.setMaxResults(maxResult);
GoogleSearchResult result_search_internet = search_internet.doSearch();
GoogleSearchResultElement[] resultElements = result_search_internet.getResultElements();
int startIndex = result_search_internet.getStartIndex() - 1 - startResult;
int endIndex = result_search_internet.getEndIndex() - 1 - startResult;
for(int i = startIndex ; i <= endIndex; i ++)
GoogleSearchResultElement resultElement = resultElements[(i)];
String title = resultElement.getTitle();
String URL = resultElement.getURL();
System.out.println(title);
System.out.println(URL);
System.out.println("");
System.out.println("Start Index = " + result_search_internet.getStartIndex());
System.out.println("End Index = " + result_search_internet.getEndIndex());
System.out.println(result_search_internet.toString());
int numResults = result_search_internet.getEstimatedTotalResultsCount();
if(result_search_internet.getEstimateIsExact())
System.out.println("Number of results: " +numResults);
else
System.out.println("Estimated number of results: " +numResults);
//catch(GoogleSearchFault gsf)
// System.out.println("Google Search Fault: " +gsf.getMessage());
try
String myKey = "0RK+HoNQFHJlcbNPfxgBpcjESUWV96aO";
String wsdl = "http://api.google.com/GoogleSearch.wsdl";
String url = "http://api.google.com/search/beta2";
String ns1 = "urn:GoogleSearch";
String searchTerm;
searchTerm = "science fiction";
String spellingRequest = searchTerm;
//First create the connection
SOAPConnectionFactory soapConnFactory = SOAPConnectionFactory.newInstance();
SOAPConnection connection = soapConnFactory.createConnection();
//Create the actual message
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage message = messageFactory.createMessage();
//Create objects for the message parts
SOAPPart soapPart = message.getSOAPPart();
SOAPEnvelope envelope = soapPart.getEnvelope();
SOAPBody body = envelope.getBody();
//Populate the message
SOAPElement bodyElement = body.addChildElement(envelope.createName("doGoogleSearch" , "ns1", ns1));
GoogleSearch search = new GoogleSearch();
search.setKey(myKey);
search.setQueryString(searchTerm);
//Save the message
message.saveChanges();
//Send the message and get a reply
//Set the destination
URLEndpoint destination = new URLEndpoint(url);
//Send the message
SOAPMessage reply = connection.call(message, destination);
SOAPPart sp = reply.getSOAPPart();
SOAPEnvelope se = sp.getEnvelope();
SOAPBody sb = se.getBody();
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
Source sourceContent = reply.getSOAPPart().getContent();
StreamResult result = new StreamResult(System.out);
transformer.transform(sourceContent, result);
//Close the connection
connection.close();
catch(Exception e)
System.out.println(e.getMessage());
}//End of method actionPerformed
public void windowClosing(WindowEvent event)
//Deals with the window closing
dispose();
System.exit(0);
}//End of method windowClosing
public void windowOpened(WindowEvent event)
public void windowIconified(WindowEvent event)
public void windowDeiconified(WindowEvent event)
public void windowClosed(WindowEvent event)
public void windowActivated(WindowEvent event)
public void windowDeactivated(WindowEvent event)
}//End of class Applet2
class Canvas0 extends Canvas
public Canvas0()
super();
public void paint(Graphics g)
Dimension d = getSize();
Font f1 = new Font("TimesRoman" , Font.PLAIN , 14);
Font f2 = new Font("TimesRoman" , Font.ITALIC , 14);
FontMetrics fm1 = g.getFontMetrics(f1);
FontMetrics fm2 = g.getFontMetrics(f2);
String s1 = "Hello , ";
String s2 = "World";
int w1 =fm1.stringWidth(s1);
int w2 =fm1.stringWidth(s2);
g.setColor(Color.GREEN);I don't know where you got the rest of this code from (was it supplied as part of the project or did you write it yourself), but I think it may be overcomplicated.
The last time (at least a year ago) that I looked at the Google WS api, this is all you needed:
GoogleSearch search = new GoogleSearch();
search.setKey("_your_key_here_");
search.setQueryString(searchStringHere);
GoogleSearchResult result = search.doSearch();You can look in their api docs for how to extract the results from GoogleSearchResult.
Hope that helps?
Kevin Hooke -
Hi ,
Can we use google maps withou API .
just by using the HTML link.. code
checked the blog :
/people/gregor.wolf3/blog/2006/06/27/geocode-business-partner-with-google-maps
Where the latitude and longitude can be changed.
How can we use the map to be displayed on web ui Accounts
page?
when searched ,the address of the bp has to be passed .
Thanks,
Anitha.Hi Robert,
you're right, in CRM 7.0 EhP1 this requirement is easy to implement using the Mashup-Tool. Here you can directly call the Google Map providing the address of the Business Partner in the URL i.e. http://maps.google.de/maps?q=TrostbergerStra%C3%9Fe128,83342,Tacherting. But also without the Mashup-Tool you can implement this functionality by creating a assignment block that provides an iView calling the BSP Application I've described in the blog or also call the URL provided above.
Best regards
Gregor -
How to access an External LDAP on a weblogic server using OPSS APIs.
Hi,
Can anyone let me know how I can access an External LDAP configured on a weblogic server using OPSS APIs( or alternative APIs).
I'm currently using the below snippet and I'm getting only the Users and groups from the DefaultAutheticator on the weblogic server and not the external LDAP Server.
I've verified the providers, users and groups on the weblogic server console and can see that external LDAP server content is being picked, but my below code does not query them.
import oracle.security.idm.IMException;
import oracle.security.idm.IdentityStore;
import oracle.security.idm.Role;
import oracle.security.jps.JpsContext;
import oracle.security.jps.JpsContextFactory;
import oracle.security.jps.JpsException;
import oracle.security.jps.service.idstore.IdentityStoreService;
List<Role> rowData = null;
JpsContextFactory ctxf = JpsContextFactory.getContextFactory();
JpsContext ctx = ctxf.getContext();
IdentityStoreService storeService = ctx.getServiceInstance(IdentityStoreService.class);
IdentityStore idStore = storeService.getIdmStore();
rowData = this.getRoles(idStore, "*");
Any help or pointers are highly appreciated.
Thanks,
BhaskerCan anyone please provide any suggestions. I trying to google around but still not able to find any solution.
Thanks,
Bhasker
Maybe you are looking for
-
Schedule lines beyond firm zone are cumulated in output
Hi All, I had my firm zone in schedule agreement upto 21st Aug, 2010. And the schedule lines under release are like this Category Del. Date Quantity Line type D 08/12/2010 6,612.000 F
-
ATT pre-order and still no phone
i pre-order on the 15th at 11:00am est order got cancel on 20th at 1am est i reordered on the 23rd at 10:00am est, i just got of the phone and i was told "all the 2nd wave of phones are going out on the 29th every one should have a tracking number by
-
Error while startup: msvcrt.dll missing
Hi, on some boxes (maybe windows 2000 ) we get a error while startup: msvcrt71.dll missing ... what´s the problem ?
-
Apps disappeared after ios 6/restore
I tried to update to ios 6.0 last night, but was told i would have to do a complete restore. Backed up everything on computer, then did the restore. Now my little apps have disappeared from my display. how do i get them back?
-
CS4 Fireworks on win7 "internal error" solved
Just to let everyone know, that deleting the Fireworks CS4 "roaming app" data solved the "internal error problems" for us... Its in the user data folder.