I have a use case where I have to consume the data from the some web service. I don't have to store that data on Drupal database, but I might cache(optional) and present the data on the browser. Drupal is just a interface between the webservice and client browser. I was looking on the modules that can be used to handle the remote activities including "Remote entity", "Feeds". But I think those modules are overkill just for getting data and rendering on the browser and also I think I had to store data on drupal with those modules. Basically I am looking for some module that will just get the data on realtime from webservice and I could use that and present that to browser on same http request.
Otherwise I am ready and set to jot down custom module!! :)
Install webservices module and create the custom module for getting the results for example showing the albums photo...or if you use view in drupal then services view module is good with services module..
You can create menu items in custom module's hook_menu like following
$menu_items['web-service-path'] = array(
'title' => 'web service title',
'type' => MENU_CALLBACK,
'delivery callback' => 'ajax_deliver', // Will make sure that complete drupal bootstrap does not load and only service code runs.
'page callback' => 'web-service-callback-function',
'access callback' => true, // Allow all users
);
Related
I have one web page name sth like that: 'https://bus/api/check'. When I run this web, it returns data normally. But when I create web source module, it shows me as below
An error occurred during URL invocation.
ORA-29024: Certificate validation failure
I search on GG about that problem. I try to solve my problem follow this web:
https://apex.oracle.com/pls/apex/germancommunities/apexcommunity/tipp/6121/index-en.html
It is very clear. I created new wallet named https_wallet and added certificate successfully. However, I check by select statement on DB, with code:
select APEX_WEB_SERVICE.make_rest_request(p_url => ''https://bus/api/check',p_http_method => 'GET',p_wallet_path => 'file:C:/temp/wallet/https_wallet',p_wallet_pwd => 'pass_word') from dual;
It shows HTTPS request failed and security violation.Futhermore, while link api web get certificate from Amazon, I try same step on another web on Google, it is ok.I don't know why that reason. Can anyone help me to solve my those problem. I do not have much experience in create web source module.
Did you tried adding the user, password (basic or oauth2). or changing the method to POST.
Another idea could be test using postman and check first if the endpoint (url) its correct.
I have two rails 4 application running on shared parent domain example.com(pdf.example.com and studio.example.com). The applications are deployed on AWS and storing session in shared Memcached.
On a page of studio.example.com, a page of pdf.example.com is loaded in iframe which covers the entire visible area. Now when user interacts with iframe content, session created in studio.example.com should reset in a sense that timeout should not happen in studio.example.com while sitting in pdf.example.com` pages.
The studio.example.com application uses devise for authentication.
Here is the configuration used to store session in memcached in studio.example.com
config/initializers/session_store.rb
Rails.application.config.session_store ActionDispatch::Session::CacheStore, :expire_after => 30.minutes
config/environments/production.rb
config/environments/development.rb
config.cache_store = :dalli_store
There are many resources out there(few listed below) addressing this scenario but all of them are using CookieStore. What sort of configuration would be different for CacheStore?
http://dev.mikamai.com/post/75476602797/sharing-session-between-your-rails-4x-app-and
http://excid3.com/blog/sharing-a-devise-user-session-across-subdomains-with-rails-3/
https://robots.thoughtbot.com/how-to-share-a-session-between-sinatra-and-rails
EDIT
Exact scenario was discussed here earlier.
The solution suggested in http://dev.mikamai.com/post/75476602797/sharing-session-between-your-rails-4x-app-and worked.
In both applications do following
Set same secret_key_base in both applications
Configure same key and domain in session_store.rb
Rails.application.config.session_store ActionDispatch::Session::CacheStore, :expire_after => 30.minutes, key: '_common_key', domain: ".example.com"
Enable caching with dalli in production.rb Dalli::ElastiCache.new('tripartite.q1ssrz.cfg.usw2.cache.amazonaws.com:11211)
config.cache_store = :dalli_store, elasticache.servers
We need to update order status to php based system using jd edwards web services. we need to make a call to below API from JDE web service.
sample code to call API from PHP is below...Similar logic we will need to use into JDE business service...
FIELD DESCRIPTION SAMPLE VALUES
key Identification token 12334566
order Order identification number 3008
json (Optional) 0 to get XML response,
1 to get JSON response 0
Parameters can be provided using GET properties, POST properties, XML or JSON.
<?php
$r = new HttpRequest('http://[enter server name/ip]/client_api/update_order/', HttpRequest::METH_POST);
$r->addPostFields(array(
'key' => '12334566',
'order' => '3008',
'json' => 0
));
try {
echo $r->send()->getBody();
} catch (HttpException $ex) {
echo $ex;
}
?>
This call will send status code response if correct/failure.
Any suggestion for possible ways to do this and any samples???
Well it's quite easy, just write your C function that call a custom JDE web service and wrap a java http get (using the standard java api) to call your backend. I don'y have an full example but you can follow the Oracle guide for BSSV consumer and search over the internet for the java http get.
I'm trying to create a very basic little backbone app that displays stats from my company's Harvest account. They have a REST API which authenticates via Basic Auth or oAuth. I seem to be faced with two problems here:
Authentication
Cross-origin requests
So I've started with setting the url for my collection to the respective url:
var Projects = Backbone.Collection.extend({
url: 'https://mycompany.harvestapp.com/projects',
});
And I've tried using this basic auth plugin but I can't tell if that part is working because I'm still getting Access-Control-Allow-Origin errors.
What's the best way to go about this?
This other StackOverflow question is similar and has more details that you should take a look at.
But the general idea is this, if you don't have access to the remote server (which I presume you do not with Harvest) then you need to perform the cross-site requests from your own server that you do control, most likely the one you are deploying this backbone app on. That means writing some server-side code (PHP, Node, etc.) to perform the requests (perfectly legal from server side) and then having your client (Backbone app) request from these scripts.
Here is a brief/pseudo-example with php:
request.php
<?php
echo file_get_contents('https://mycompany.harvestapp.com/projects');
?>
projects.js
var Projects = Backbone.Collection.extend({
url: 'request.php',
});
I am trying to understand what things happen in the background when using a website OR basically what are the things that happen when a user interacts with a browser. I understand that this is a huge list and highly dependent on architecture and user actions etc, I am just trying to get a feel of major things and flush my misunderstandings and also use this to read more about stuff I don't understand.
As an exercise I am trying to note down things that happen in the background with respect to users action in a browser. Here is my attempt at this bit open ended but fun question:
User enters a url => browser checks if
available in browser cache => DNS look
up [root dns lookup => recursive dns
=> get ip ] => establish a tcp connection => send http req => get
the static page from web server=> if
authentication is required that
happens [either read cookies from
browser OR ask user to enter
credentials] => somehow gets the
dynamic elements as well [how ? ,
there is some lazy initilization here
?] => Then user performs some
action[clicks a link or something] =>
check browser cache => if not avail
[take the input parameters and embed
in the url in some manner [may be
encrypt some things if required] =>
hits a load balancer => directed to a
application server [depending on how
the LB selects a host] => application
server cache is checked [memcached or
some kind of caching, not sure if this
"normally" happens here or at some
other level] => application server
tries to understand the request [if
its a service listening on some port,
http port 80 it will get the URL and
parse to perform some operations] =>
database is queried if required to =>
there might again be connection
mgmt/caching/parallel queries etc here
=> database returns back the result to app server => app server creats a
result payload and headers [http] =>
sends it to browser for rendering =>
browser cache is updated => user
reacts to the response.
I have not considered retries/failures and how they are handled, but I would like to get some input there as well in a general sense
Note:
I am looking at things in general, I am sure that few companies might do it in different way etc etc. I will like to hear alternatives as well though!.
This is an effort to try and get more
perspective and read on few things
that will help me in general.
Clearly I have made an honest attempt
I also hope this would help others
looking at the question in general to
learn something new.
I am not asking
for opinions etc, so this aint a
completely open ended question [not
everything is right though there are
many options]
Thanks !
There is no difference between static or dynamic for browser. Browser makes HTTP request and gets HTTP response. If response is an HTML page, then browser renders HTML ,applies styles, and executes JavaScript code that come with page. This page can by dynamic or static - browser don't care! The side is care - is server side. If page is static, than HTTP server will just take page from disk and send it to client as HTTP response. If page is dynamic, than HTTP server will call some application and will ask this application to give requested resource. This application can be an PHP module for Apache(http server), or ASP.net for IIS, or even your C++ code that will generate any content you want.
How exactly page or resource (HTTP response can be also xml, or image etc) will be constructed depends on used application (server side technology).
As example, if you are using PHP - HTTP server will detect that requested resource has extension .php, server will pass this PHP file to PHP module for processing, and result will be sent to HTTP client(browser) as response.
When user perform some action, this is again just usual HTTP request. HTTP method GET and POST (look for article about HTTP on Wikipedia) is used to pass some input from server to client. Page can contain some heavy JS, that will make page look more like desktop application (rich controls, dynamically reacting on user action without request to server, or communicate with server in background), but this is not necessary for web application to be web application (for web site to by dynamic). It can be good old static HTML with HTML forms, and some server side code.
Web application is abstract entity that may consist from many HTTP resources (different URLs for server to response). Web application also is client-side code that communicates with server-side code thru HTTP with help of HTTP client(browser) and HTTP server. Web application is not some stand alone part, that only comes to work when user perform some action.
Web-service may fits this description - as thing that usually don't care about pages, and comes only when some action required. Its special type of web application, that expose some API thru HTTP(usually). You can request some resource, and pass some parameter, and you will get response with some result. It's same web application but without pages. But web-service usually part of big web application with pages, or even other part of same web-application (depending on how you look at this). It can be same server-side technology, and same HTTP server. And it's not necessary to create web-service if you want to make some web-application (dynamic web site).
Server-side part of web application can also communicate with some database, but it's not necessary too.
There can be real database, or just some text files on disk. And browser, client side code and HTTP server also don't care about database or source where server side code takes data.
Cache, load balancer, etc - it's just additional elements that usually are transparent for all this general stuff.
Cookies is passed with every HTTP request to HTTP server, and if requested resource is not static page, that HTTP server will pass them further to server-side code/application(part). And its usually how authentication and authorization works - cookies has contain info about session, and there is some data associated with session contains on server side - it can be ID of user, so server-side code will recognize user on every request.