Package net.oauth.client

Examples of net.oauth.client.OAuthClient.invoke()


    }
    OAuthAccessor accessor = createOAuthAccessor();
    accessor.tokenSecret = props.getProperty("tokenSecret");
    OAuthClient client = new OAuthClient(
        new HttpClient4(new SingleClient()));
    return client.invoke(accessor, "GET", url, params);
  }

  public String prepareOAuthHeaderForAccesingResources(Properties props,
      String method, String resource, String updateStatus)
      throws Exception {
View Full Code Here


        OAuthMessage message = accessor.newRequestMessage("POST", rpcServerUrl, null, bodyStream);
        message.getHeaders().add(
            new SimpleEntry<String, String>(HttpMessage.CONTENT_TYPE, JSON_MIME_TYPE));
        message.getHeaders().add(new SimpleEntry<String, String>("oauth_version", "1.0"));
        OAuthClient client = new OAuthClient(httpFetcher);
        responseStream = client.invoke(message, net.oauth.ParameterStyle.BODY).getBodyAsStream();
      }

      String responseString = HttpFetcher.readInputStream(responseStream);
      if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Response returned: " + responseString);
View Full Code Here

      new OAuthAccessor(getOAuthConsumer(client, provider));
    accessor.accessToken = requestToken.token;
    accessor.tokenSecret = requestToken.secret;

    OAuthClient httpClient = getOAuthClient();
    OAuthMessage message = httpClient.invoke(accessor, "GET",
        provider.accessTokenUrl, null);

    return new Token(message.getToken(),
        message.getParameter("oauth_token_secret"));
  }
View Full Code Here

       
        access.accessToken = requestToken.getPublicKey();
        access.requestToken = requestToken.getPublicKey();
        access.tokenSecret = requestToken.getSecret();
       
        responseMsg = client.invoke(access, "GET", this.getClientSettings().getOAuthAccessTokenUrl(), null);
       
        this.getUserSpecificAccessToken().setPublicKey(responseMsg.getParameter("oauth_token"));
        this.getUserSpecificAccessToken().setSecret(responseMsg.getParameter("oauth_token_secret"));
     
    } catch (Exception e) {
View Full Code Here

   
   
    try
    {
                 
      responseMsg = client.invoke(access, method, baseUrl, params.entrySet());
     
      return responseMsg.readBodyAsString();
     
    }
    catch (Exception e)
View Full Code Here

        OAuthMessage message = accessor.newRequestMessage("POST", rpcServerUrl, null, bodyStream);
        message.getHeaders().add(
            new SimpleEntry<String, String>(HttpMessage.CONTENT_TYPE, "application/json"));
        message.getHeaders().add(new SimpleEntry<String, String>("oauth_version", "1.0"));
        OAuthClient client = new OAuthClient(httpFetcher);
        responseStream = client.invoke(message, net.oauth.ParameterStyle.BODY).getBodyAsStream();
      }

      String responseString = HttpFetcher.readInputStream(responseStream);
      LOG.info("Response returned: " + responseString);
View Full Code Here

    public ArrayOfInvoice getInvoices() throws XeroClientException, XeroClientUnexpectedException {
        ArrayOfInvoice arrayOfInvoices = null;
        try {
            OAuthClient client = new OAuthClient(new HttpClient3());
            OAuthAccessor accessor = buildAccessor();
            OAuthMessage response = client.invoke(accessor, OAuthMessage.GET, endpointUrl + "Invoices", null);
            arrayOfInvoices = XeroXmlManager.xmlToInvoices(response.getBodyAsStream());
        } catch (OAuthProblemException ex) {
            throw new XeroClientException("Error getting invoices", ex);
        } catch (Exception ex) {
            throw new XeroClientUnexpectedException("", ex);
View Full Code Here

    public Report getReport(String reportUrl) throws XeroClientException, XeroClientUnexpectedException {
        Report report = null;
        try {
            OAuthClient client = new OAuthClient(new HttpClient3());
            OAuthAccessor accessor = buildAccessor();
            OAuthMessage response = client.invoke(accessor, OAuthMessage.GET, endpointUrl + "Reports" + reportUrl, null);
            ResponseType responseType = XeroXmlManager.xmlToResponse(response.getBodyAsStream());
            if (responseType != null && responseType.getReports() != null
                    && responseType.getReports().getReport() != null && responseType.getReports().getReport().size() > 0) {
                report = responseType.getReports().getReport().get(0);
            }
View Full Code Here

    public void postContacts(ArrayOfContact arrayOfContact) throws XeroClientException, XeroClientUnexpectedException {
        try {
            String contactsString = XeroXmlManager.contactsToXml(arrayOfContact);
            OAuthClient client = new OAuthClient(new HttpClient3());
            OAuthAccessor accessor = buildAccessor();
            OAuthMessage response = client.invoke(accessor, OAuthMessage.POST, endpointUrl + "Contacts", OAuth.newList("xml", contactsString));
        } catch (OAuthProblemException ex) {
            throw new XeroClientException("Error posting contancts", ex);
        } catch (Exception ex) {
            throw new XeroClientUnexpectedException("", ex);
        }
View Full Code Here

    public void postInvoices(ArrayOfInvoice arrayOfInvoices) throws XeroClientException, XeroClientUnexpectedException {
        try {
            OAuthClient client = new OAuthClient(new HttpClient3());
            OAuthAccessor accessor = buildAccessor();
            String contactsString = XeroXmlManager.invoicesToXml(arrayOfInvoices);
            OAuthMessage response = client.invoke(accessor, OAuthMessage.POST, endpointUrl + "Invoices", OAuth.newList("xml", contactsString));
        } catch (OAuthProblemException ex) {
            throw new XeroClientException("Error posting invoices", ex);
        } catch (Exception ex) {
            throw new XeroClientUnexpectedException("", ex);
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.