I need to connect PHP client code to JAVA backend, where the actions are :
1. http request will be sent from PHP client.
2. It will interact with JAVA code on Model and will store data in Nosql using JAVA backend
I read about this php-java bridge
Which can be better PHP-JAVA bridge to use?
Take a look at Project Zero and Quercus. Both of those may be helpful. The php-java bridge that you linked to may prove most useful though as its built to work with the official PHP distribution.
Related
In my project need to create the following architecture:
Front-End application is a web site resource that will combine HTML+React technologies.
Back-End is a java application that will be connected to Mongo DB to operate with data.
Now, in the middleware should be placed Node.js. And after reading a lot of info on the internet, I have now some confusions regarding this.
As I understand Frond-End will be routed to node.js (and now the question is it Express.js-- the same thing or it's different) which is also connected to Mongo Db and Java application(this is doing all logic).
Can someone explain me should use express.js with the integration of node.js in order to route to java server application?
If you want to use a middleware. Nodejs can help you do that in a lot of ways, you can use express.js so that you won't have to do more request/response parsing work. And when you want to connect to your java server using nodejs, you can also integrate that by calling the java server API endpoint by using some http library like axios then you can directly communicate to java server app to directly communicate to the backend mongodb.
But your Front-End application can also directly communicate through your backend java by creating a REST API. And store all your business logic in the java REST API.
I am currently tasked to build some kind of healthcheck-application, which is later to be included in a jboss environment. But first things first. I need to access 3 different types of databases: MS SQL relational, TM1 and MS SQL Analysis Servies. While the first two seem to be manageable, I have encountered a problem trying to access Analysis Services through java. Most commonly, the olap4j library seems to be used, but this is based on the msmdpump.dll, tunneling the response through the IIS. We cannot use this approach, since the IIS is not in use and we do not have system access to the Analysis Services Server.
In short words: How to access Analysis Services in Java without using msmdpump.dll? We need to send simple querys in either MDX or XMLA. Both client and server are using Windows Server 2008 R2. The Analysis Services version is 2008 R2 as well. Analysis Services is provided to us as a service, we do not have access to the system itself.
It seems to be an option to use a powershell script to access Analysis Services and to call this script through java. But I would rather avoid this approach if there is a better option.
Thanks for any help!
I do not think you can avoid the msmdpump.dll in IIS if you want to call Analysis Services from Java.
The Analysis Services server itself uses SOAP structurally but a Microsoft specific binary SOAP format (see http://sqlblog.com/blogs/mosha/archive/2005/12/02/analysis-services-2005-protocol-xmla-over-tcp-ip.aspx for some details). This communication protocol is understood by the ADOMD.NET client driver and msmdpump.dll and nothing else. Thus you can can use write your application in .net or any language capable of interfacing with .net - or you can use any environment on the client that can send and receive http requests via msmdpump.dll hosted in IIS. Actually, msmdpump.dll does nothing else but a translation between TCP using binary compressed XML and http using uncompressed standard XML (and translating between the http authentication mechanisms and integrated security which also can be difficult to implement in Java).
As far as I am aware, Microsoft claims some rights on their binary protocol, so you may even violate their rights in case you would try to develop a tool yourself that directly talks to AS from Java.
Thus the only way to not use msmdpump.dll in IIS as a proxy between you Java application and the AS server would be to develop your own proxy in .net that would more or less implement what msmdpump.dll does already: translate between TCP using binary compressed XML and some other protocol that you define between your .net component and your Java component, probably just exchanging the XMLA request and the XML answer. Or you could implement a more high-level API between ADOMD.NET and your Java application. But there would be no way around some .net development in this case, which I would not think to be worth the effort and complexity.
2 month ago i started to develop an android application which needs to call remote methods and receive complex objects (custom objects with custom feilds in it) from a server.
My friend and I splitted the work so he worked on the android client and i on the server.
Before we started, we built the base interfaces which provide the functions that the client needs from the server, so my friend can program easly the application (by using fake classes as implementation for the interfaces), and after i finish the implemntations of the interfaces in the server-side he will make the connection and call the functions from the server and not from the fake classes.
Now the problem is that we can't find a way to pass those interfaces from the server to the client.
We tried to use java RMI, but we faild because android doesn't support java RMI,
then we tried to use JAX-WS (with tomcat 7) and we also faild because JAXB can't handle intefaces. (-you can see more details here about jaxb issue-)
My friend and I feel really lost.. we don't have any idea how to pass those interfaces between the server and the android client.
Is it possible what we're trying to do? if not,
what other options avaible for us to call remote methods and receive complex objects from the server?
Thanks!
You can expose webservices on the Server, so the client can interact with the server whenever its needed that might be quickest solution.
Or you can write a kind of servlet programming to get the json request from the client, process it and send the json respoonse back to the client. If the application is data intensive, the JSON helps you a lot
Not sure if this is too late now (after 2 months of development), but there are frameworks that should make RPC easier for you (take care of linking both ends). Two I know of are Apache Thrift (definitely usable with Android - there are apps that use it) or Apache Etch (possibly).
Apache Thrift:
http://thrift.apache.org/
Apache Etch:
http://incubator.apache.org/etch/
Blog about Evernote choice of Thrift:
http://blog.evernote.com/tech/2011/05/26/evernote-and-thrift/
If your application is limited to communication between Java on the server and Android (no other clients e.g. IOS) then an easier RPC path compared with IDL based solutions is to use jsonrpc. This solution provides both server and Android client components. It is extremely easy to implement on both client and server. One limitation is that byte arrays have to be encoded because the JSON transport does not support binary.
I am developing a php based application which has java as middleware for web services. Is there any frameowork/middleware available in php stack which allows me to write services in php and also hosted on php based app server, lets say Zend?
Thanks
Typically I'd expect the middleware to be the webservices - are you consuming or providing webservices using PHP?
Not that it makes much difference, PHP supports both.
You can roll your own solution, or use PHP Soap, the nuSoap PHP lib and xmlrpc. There's also the php/java bridge which implements a socket based abstraction for both ends (but obviously this is not strictly a web service).
Following my question regarding connecting to a MySQL database in Java, I am looking to create a web service in PHP. My Java program needs to ask the web service to gather some data from MySQL database and send the result back. However, I have a few dilema's:
Firstly, my web hosts do not support Java, and therefore the server side needs to be written in PHP but the client needs to be written in Java.
Secondly, all the tutorials I have found seem to involve creating a whole web service project in order for my Java program to communicate with the web service, where as realistically only a couple of classes need to contact the PHP web service.
And, you may have already guessed but I don't know anything about web service's. It was just suggested that I used one in order to get around the GPL licence of the JDBC driver...
I realise that similar questions may have been asked here before but as I am a complete novice, the posts that are saw here did not contain enough information for me and I require as much help as I can get - almost a step by step guide!
Alternatively, I did think about just using standard PHP Sockets, as I am pretty sure I know how to use them. However, I don't know how secure they are and I didn't want to take any risks because I will be needing to retrieve information such as licence keys!
Thanks in Advance
You don't need to use PHP Sockets, all you need is a simple PHP script on your web host that fetches the data you need from the MySQL DB and outputs the data to be read by your Java client.
Your PHP script will need:
To retrieve any query parameters from the Java client (probably
via $_POST or $_GET).
Information to connect to MySQL (hostname/ip address, db name,
username, password).
To run SQL query/queries to grab the data from the database.
To output the data for the java client to read, in some mutually-acceptable format, such as XML, JSON, HTML, etc.
You would structure the script something like this:
<?php
// 1. Read and validate input parameters
$myquery_val = $_POST['queryval'];
// 2. Connect to MySQL
// 3. Fetch MySQL data
// 4. Output data
?>
To learn how to connect to MySQL and retrieve data, read up on MySQL PDO: http://php.net/manual/en/ref.pdo-mysql.php
What I would do is use an agnostic form of communication between your PHP service and the Java client. My weapon of choice is XML.
The steps would be:
Create the PHP classes which will interact with your database and get the data you want to work with. GitHub has plenty of examples and source code. Sample PHP-MySQL Database Abstraction Layer
Create a RESTful php service which takes the data from step 1 and makes it into an XML REST service. Checkout the Recess Framework, an easy to use REST framework
Create your JAVA client, it should just need to be able to work with HTTP, and consume XML. No need for a huge soap or other framework.