Direct Rest Call To Google Api

Hi, I am trying to get Calendar list from my  Google account using WebClient class. It is throwing 401 unauthorized error. My login credentials are correct but can't figure out what is wrong in my code. Here the code I am using to access Google Calendar
Api. Please someone also tell me how to  use auth token as I know how to generate token but don't know how to use it in Webclient Api Class. I searched everywhere in Google but can't find a single example of making direct REST call to google api. 
var content = "";
try
var url = "https://www.googleapis.com/calendar/v3/users/me/calendarList";
var synClient = new WebClient();
//string credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(userName + “:” + passWord)); this one did not work.
string credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes("use" + ":" + "pass"));
synClient.Headers[HttpRequestHeader.Authorization] = "Basic" + credentials;
content = synClient.DownloadString(url);
Console.WriteLine(content.ToString());
}catch(WebException e)
Console.WriteLine(e.Message+" "+e.StackTrace);

Hi, I am trying to get Calendar list from my  Google account using WebClient class. It is throwing 401 unauthorized error. My login credentials are correct but can't figure out what is wrong in my code. Here the code I am using to access Google Calendar
Api. Please someone also tell me how to  use auth token as I know how to generate token but don't know how to use it in Webclient Api Class. I searched everywhere in Google but can't find a single example of making direct REST call to google api. 
var content = "";
try
var url = "https://www.googleapis.com/calendar/v3/users/me/calendarList";
var synClient = new WebClient();
//string credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(userName + “:” + passWord)); this one did not work.
string credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes("use" + ":" + "pass"));
synClient.Headers[HttpRequestHeader.Authorization] = "Basic" + credentials;
content = synClient.DownloadString(url);
Console.WriteLine(content.ToString());
}catch(WebException e)
Console.WriteLine(e.Message+" "+e.StackTrace);
Please check out the documentation
here. It explains how to use it. It has a form to test requests:
HTTP request
GET https://www.googleapis.com/calendar/v3/users/me/calendarList
https://developers.google.com/google-apps/calendar/v3/reference/calendarList/list#examples
https://developers.google.com/google-apps/calendar/firstapp
You could using API directly too: http://www.codeproject.com/Articles/64474/How-to-Read-the-Google-Calendar-in-C

Similar Messages

  • REST Web Service References: Can't run Google APIS

    Hello Everyone!
    I am learning on how to integrate REST web service reference in APEX application. I found a tutorial video at YouTube on 'Creating and Using a RESTful Web Service in Application Express 4.2', which found to be very helpful and easy to do on my sample app. The REST Web Service URL:
    http://maps.googleapis.com/maps/api/geocode/xml?address=san%20fancisco&sensor=false
    But my application throws an error as below:
    1 error has occurred
    ORA-29273: HTTP request failed ORA-06512: at "SYS.UTL_HTTP", line 1130 ORA-24247: network access denied by access control list (ACL)
    After going through some of the posts here at OTN, I have granted access as follows:
    GRANT EXECUTE ON SYS.UTL_HTTP TO ETI;
    GRANT EXECUTE ON SYS.UTL_INADDR TO ETI;
    GRANT EXECUTE ON SYS.UTL_TCP TO ETI;
    GRANT EXECUTE ON SYS.UTL_SMTP TO ETI;
    GRANT EXECUTE ON SYS.UTL_URL to ETI;
    GRANT EXECUTE ON SYS.UTL_XML to ETI;
    Second thing I did was, created and assigned ACL:
    begin
      dbms_network_acl_admin.create_acl (
        acl         => 'googleapis.xml',
        description => 'Google Translate API',
        principal   => 'CONNECT',
        is_grant    => true,
        privilege   => 'connect',
        start_date  => null,
        end_date    => null
      dbms_network_acl_admin.add_privilege (
        acl       => 'googleapis.xml',
        principal => 'CONNECT',
        is_grant  => true,
        privilege => 'connect'
      dbms_network_acl_admin.assign_acl (
        acl  => 'googleapis.xml',
        host => 'ajax.googleapis.com'
      dbms_network_acl_admin.assign_acl (
        acl  => 'googleapis.xml',
        host => 'maps.googleapis.com'
    end;
    All these statements were executed on my database with out any error, even though not helping my web service reference to work.
    Any idea how can I get my Google API REST Web service working, what is the thing I'm missing here?

    I apologize for the lack of information.
    I thought I had included a list of schemas for you to try out.
    At first, (due to the GRANT ___ TO ETI;) I thought you were writing your own Web Service parser in PL/SQL.
    (If that was the case, than ETI would need be part with the ACL)
    Then, I realized,you were using the built in APEX functionality.
    In this case, try adding your APEX_{version} schema as part of the ACL.
    I'm not sure if this will work (I haven't tried it).
    However, I do know you need to add the APEX_{version} to the ACL if you use the LDAP Authentication.
    finding APEX_{version}
    select comp_id, version, status, schema
    from dba_registry
    where comp_id='APEX'
    MK

  • 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

  • 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);

  • Error in Receiver Soap Adapter for Google API

    Hi,
    I am working on HTTP-XI-Soap scenario which on the receiver side calls google API for spell check.
    I get the following error : <b>No Deserializer found to deserialize a ':key' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.</b>
    However if I try calling the webservice individually using SOAP Client it works fine and do get desired response.The soap message that is sent by the client to the target URL is :
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:GoogleSearch" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <soapenv:Body>
          <urn:doSpellingSuggestion soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
             <key xsi:type="xsd:string">qXWD4x1QFHIo/dePqlYOLwT7kMmkv80E</key>
             <phrase <b>xsi:type="xsd:string"</b>>Bratney</phrase>
          </urn:doSpellingSuggestion>
       </soapenv:Body>
    </soapenv:Envelope>
    However if i remove the "xsi:type="xsd:string" part from the element 'phrase' and 'key' it returns the same error as it does while using with XI.
    Hence I am assuming that that the outgoing soap message elements need to have the above highlighed attribute.
    Now I want to have this attribute(xsi:type="xsd:string) in the soap message that is sent from XI.
    My question is , Is there any setting using which I can add the attributes in the above form to the outgoing message from XI.I do not want to use a adapter Module.
    Thanks & Regards,
    Sidharth

    Hi Sidharth,
    You post here the soap message that is sent by the client to the target URL, but did you look to the soap message that is sent by XI?
    Try the AF monitor http://<host>:<j2ee-port>//MessagingSystem/monitor/monitor.jsp?
    Because XI soap adapter doesn't support all tags of wsdl rpc-based, we need to adjust them...
    Look to the SOAP FAQ (SAP note number 856597) under question "Can I convert an RPC styled WSDL to a document styled WSDL?"... Look at last but one paragraph ;o)
    So, you need to change this attribute to one that it is compatible...
    Go to http://service.sap.com/xi > Media Library > Documentation and there you will find this xls document -> SAP XI 3.0 (SP11) - Supported XML Schema and WSDL (EN) in this document you have all the compatible elements of wsdl for XI.
    One more thing, you can adjust your soap request and change or add the required tags You can do it with xslt-mapping or create your won data types in XI without import the WSDL generated by google. 
    Hope it helps,
    Ricardo.
    Message was edited by: Ricardo  Quintino

  • MS CRM 2015 :DB locking issues while calling a web API inside an asynchronous Plugin.

    Hi,
    We have a SharePoint Integration where a Web API is deployed on SharePoint Server.We are calling this Web API in asynchronous plugin. Although the Plugin works fine. But  its causing DB issues .other custom applications like schedulers are breaking
    and showing time-out issues. 
    I analysed it and found that Web API sometime failed to instantiate the Proxy object ( Exception ::System.Net.WebException: The operation has timed out ).
    This results into the exception in  plugin OR cause of DB locking. 
    Kindly suggest how to resolve this issue.
    Thanks,
    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer". Thanks and Regards, Mohammad Yusuf Ansari
    http://microxrm.blogspot.in

    ianp123,
    It appears that in the past few days you have not received a response to your
    posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Visit http://support.novell.com and search the knowledgebase and/or check all
    the other self support options and support programs available.
    - You could also try posting your message again. Make sure it is posted in the
    correct newsgroup. (http://forums.novell.com)
    Be sure to read the forum FAQ about what to expect in the way of responses:
    http://forums.novell.com/faq.php
    If this is a reply to a duplicate posting, please ignore and accept our apologies
    and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Product Support Forums Team
    http://forums.novell.com/

  • How do you pass a TES variable in a REST call?

    I am trying to create an email action using the EmailAction.create REST call.  I am able to successfully create an email action, but I cannot get it to work while trying to pass a TES variable (i.e. <JobName>) in the message body.
    Does anyone know how tis is done?

    Here is the XML code:
    <?xml version="1.0" encoding="UTF-8" ?>
    http://purl.org/atom/ns#">
        3
        HTTP
        http://www.tidalsoftware.com/client/tesservlet">
                EJS
                            [email protected]
                            Test Api
                            This is a test, only a test of the rest API.
                            [email protected]
                            test3_email
                            5
                            N
    In the I wnat to pass .

  • SOAP or REST Calls and will it work?

    Hi
    I am currently working on a project where we have to make a RFC call to a DESTINATION type "G" HHTP connection to external server. It has come to my knowledge that normal RFC calls cannot be made to these destination types but rather REST Calls or SOAP calls should be used.
    my question is which would be the easiest to implement?
    All i wish to do is to pass the external server a parameter, which it would check and would then reply whether or not it exists on the server.
    So, SOAP or REST? And does anybody have some good example or material regarding implementing these methods from the basics?
    Thanks!
    A.D.Oosthuizen

    Even a four-year-old MacBook should have come with Mac OS X 10.5 Leopard. Leopard can run the latest version of iTunes; it will download and install pretty much automatically if you run Software Update.
    You might first have to be sure that you are running the latest version of Leopard, which is 10.5.8. This, too, will download and install for you if you run Software Update. Just keep running Software Update until there is nothing left to download and install (you might have to run it more than once because some updates require previous updates to be installed first).
    If you have a version of Mac OS X earlier than 10.5, then you can't run the latest version of iTunes. You will need to buy a more recent version of Mac OS X. You must be running at least 10.4 Tiger, and you can upgrade directly to Snow Leopard from Tiger. Apple still sells Snow Leopard for about $30 and you might find it slightly less at a retailer or on eBay. After upgrading to Snow Leopard, you will be able to upgrade to Lion using the Mac App Store for another $30 or so if your MacBook meets the minimum system requirements.

  • Direct Database calls from FLEX client

    Hi all,
    is there any way to make direct database calls to a MySQL database (or any other database) from a FLEX client, rather than invoking through a service? simply, i need to remove the middle tier.
    Thanks in advance.
    SajKK

    Air only supports SQL Lite for now may be more in future.
    http://www.adobe.com/devnet/air/ajax/quickstart/sync_simple_sql_database.html
    http://www.insideria.com/2008/03/air-api-querying-a-local-datab.html
    http://ntt.cc/2008/07/08/sqlite-example-for-adobe-air-working-with-local-sql-databases-wit h-source-code.html

  • Use Stored Procedure to call up DI API

    HI all,
    I will like to know whether i can use stored procedure to create DI API when i triggers on new document on particular customer?
    Example:
    Database A create AR Invoice then i triggers on it directly use stored procedure to call up DI API to create AP Invoice on Database B without create any necessary add-on on the same server.
    Thank you.
    Cheers,
    danny

    Hi Danny,
    Sorry to inform you that it is impossible to call DI in stored procedure.
    An AddOn handling FormDataEvent,  DI Event service and B1iSN would be the right approches to your requirement.
    1.DI Event Service and B1iSN are solutions in server side. You can find DI EventService here:
    SAP Business One Tools [original link is broken]
    =>DI Event Service=>View this article
    Then you can find a sample project in its installation folder.
    2.AddOn soultion will be in the client of source company, just one addon is fine.
    sample code:
    Private Sub FormDataEventHandler( _
        ByRef BusinessObjectInfo As SAPbouiCOM.BusinessObjectInfo, _
        ByRef BubbleEvent As Boolean) Handles oApp.FormDataEvent
            'You may add the target documents, 133 - A/R invoice.
            'Before action = true, start the transation
            If BusinessObjectInfo.FormTypeEx = "133" _
                    And BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD _
                    And BusinessObjectInfo.BeforeAction = True Then
                oCompany.StartTransaction()
                'BubbleEvent = False
            End If
            'Before Action = false,
            'Update product item tree
            'Succeed, commit, otherwise rollback
            If BusinessObjectInfo.FormTypeEx = "133" _
            And (BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD) Then
                If BusinessObjectInfo.BeforeAction = False And BusinessObjectInfo.ActionSuccess Then
                    Dim objectKey As String = String.Empty
                    oCompany.GetNewObjectCode(objectKey)
                    MsgBox(BusinessObjectInfo.Type)
                    Dim oInvoice As SAPbobsCOM.Payments = Nothing
                    oInvoice = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
                    If oInvoice.GetByKey(CInt(objectKey)) Then
                        Dim paymentInvoices As SAPbobsCOM.Payments_Invoices = oInvoice.Invoices
                        Dim oInvoices As SAPbobsCOM.Documents = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)                   
                        '======================================================================
                        'add you code to add A/P Invoice in company B
                        'oInvoices.GetByKey(***)
                        'lRetCode = add an A/P invoice according to A/R invoice above...
                        '======================================================================
                        'We don't need to rollback manually, it will be automatically rollbacked if any error ocurrs
                        If lRetCode = 0 Then
                            'update the production tree succesfully,
                            oCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit)
                        End If
                    End If
                End If
            End If
        End Sub
    Kind Regards, Yatsea

  • Google API and portal

    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,
    Anagha

    should 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

  • Possible to make calls with Google Voice account through iChat?

    I have a Google Voice account (have for a while now), which allows me to make calls through VOIP. I've recently lost phone service and have noticed that an option when making calls in Google Voice is through Google Chat.
    Now, I can never get Google Chat to work on my Macbook, so I was wondering if anyone knew of a way to get it to work with iChat.
    I have signed into my Google account through iChat, but when I make calls in Google Voice and I select to call through Google Chat, it says "Calling You" like it would if I were using my phone as the proxy, but it doesn't do anything.

    I think I figured out how I want to do this.
    For others in similar situations (this is assuming you HAVE a Google Voice account, which they don't give out anymore, AFAIK), go to http://www.google.com/talk/ and download the plug-in on the left. Install it, then open up your gmail in browser. On the left side, there will be a section that can let you make calls directly from your computer. SUCCESS!!

  • Remote call to worklist API

    Although sample code of remote call to worklist API is mentioned around Ch.16 (P.16-45) in "Building a Worklist Application Using the Worklist Application API", would you mind supplement about how to specify the JNDI in more details.
    Thanks in advance.
    Best Regards,
    Simon.

    Yes, That's very helpful.
    But, The file "hw_worklist_jndi.properties" is specified in the server, right? Then, my rest of the problem is how to specify the client side?
    Say, we have some codes (in client side) as follows:
    RemoteWorklistServiceClient client = new RemoteWorklistServiceClient();
    client.init();
    IWorklistContext ctx = client.authenticateUser("jcooper", "abc");
    Then, anything we need to specify before "new RemoteWorklistServiceClient()"? Say, we need to use Locator? And, how? Or, some config file like "hw_worklist_jndi.properties" in client side too?
    Thanks a lot.
    Best Regards,
    Simon.

  • Suggestion: Direct Video Call using 3G network.

    I found there is not Direct Video Call option in any Android version by default Like it is in iPhone and Symbian phones, we can do a Video Call directly using the 3G network by dialing the number like we dial it for a normal call. Samsung and some HTC phones have implemented this in their andriod phones. I want to suggest please implement this Video calling feature in Sony Xperia phones. Note: I am not talking about Video call using any Video Calling App like skype or hangout or tango etc. I am talking about direct 3G network Video Call by dialing the number. So better people avoid replying to the post with useless replies

    You might be right at your place, many people may not need it because there are many free video calling apps in google play. But if you believe me, there are still some people here in our region, they do not know how to use google play or a google ID, and if they do not know what is google play how they will download an app for a video call.many people are backword here, some of them even do not know how to use these video call APPS. The purpose of my this suggestion is for those people who are not able to download and who are not able to use these video callings apps. if this features enables, they can just make a video call like a normal call only network data charges apply and that is it. I have also requested the same feature to android.

  • Authorize Google API

    We are using Apex Web Services and can successfully connect to certain google apis. However in the initial authorization process where the user authorizes the app in the Google environment, upon returning to the callback url, the user has to log in to the apex application again. Is there a secure way to keep the user in the same session so they don't have to login again. Tried setting the 'state=' param to the value of the current session ID, but don't see how to pass it back in the call back URL.
    Thanks.

    I would post my question here...
    http://groups.google.com/group/codesite-discuss

Maybe you are looking for