Php - middleware - java

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).

Related

Can't decide how correctly to use backend?

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.

Communication between JSP/Servlet and PHP pages?

I am working on a web based Java application(on localhost) and I want to send email using a PHP script which is hosted on a free web hosting site and also return to my java app.
Like this ->
Java(localhost)---->PHP(send mail)---->Java(localhost)
Few questions regarding this?
How to do this?
What about the session stored by the java app? Will the PHP script
read or interpret java's session?
My suggestion is Implement an web service (in REST or SOAP Architecture) with php
then in java code call your web service and Implement an acknowledgement response for
successful or failure mail sending operation in your php!
SOA (Service Oriented Architecture) could be one of best approach for communication between
different platforms.
if you use php only because of ease of sending mail it would be fine to know that java also
have JavaMail API that can be used for mailing application very easily
I hope it be beneficial
Regards

Is it possible to use GWT with (both) Java and PHP backend?

Ok, this is the scenario: I've developed a webapp running Java at backend, everything is working pretty well, but now I have to integrate a PHP module (boss requirement) within the whole system.
So, I need to know if both backends can co-exist in a single application and how can I accomplish that.
Yes, you can do it using GwtPhp.
Unlike most of the other frameworks, GwtPHP is a framework for both client and server part. Server part uses PHP 5 - the most used web scripting language today.
It does not sound as if your boss is being reasonable!
There are some possibilities, though:
You could have the server-side entirely in PHP. Obviously you'd still have Java for the client-side because GWT requires it, but GWT can communicate via HTTP to any type of server using XML. You just can't use GWT's RMI-like interface if it's not a Java server.
Alternatively, you could have a separate PHP layer in your app, and the server-side Java itself can call it using HTTP.
Finally, (and more difficult, and experimental) there is a project to allow PHP to run in a Servlet Container, which may give you the ability to mix Java and php: see http://www.php.net/manual/en/intro.java.php
Two things spring to mind.
1) If the PHP app supports JSONP you could run it on a separate server and interact with it that way.
2) Stick the servlet container behind apache and proxy to the servlet container using something like the AJP connector. This would mean that apache forwards the GWT requests to tomcat/jetty whatever and serves the PHP itself.

Java and .NET application communication

I don't think this is quite possible or if it is recommended to do... but is there a way to connect or comunicate or deploy Java and .NET application for method beside Web Services. I mean I understand there are Messaging server that allows Java application communicate to each other but I dont know if this can cross development environment, any suggestion about it or thoughts about this?
I'm limited to web and desktop environments.
Apache Thrift is a way to go. You will need to write a service definition like this:
serivce helloworld{
string sayHello(1:string name)
}
Thrift then will generate RPC interface with network layer already implemented, It support many others language such as Java, C#, PHP, Python. Thrift support binary protocol over TCP/IP, so it's very fast.
for more, go to its wiki page http://wiki.apache.org/thrift/
You can use something like Apache ActiveMQ which uses JMS on the Java side and the .NET Messaging API on the .NET side.
We ended up writing our own implementation of Java-.Net communication protocol based on Hessian (later added JSON as well), but Thrift is a valid option.
The virtual machines (JVM vs CLR) are not going to talk to each other except through some OS level open standard. Shared Files (yuck), Sockets and Web Services come to mind. There is nothing that would allow you to call a .net subroutine from java or vice-versa.

best way to communicate between .net and java

I have a .net application which needs to expose a service consumed by a java client. The service can't be public. There should be some authentication mechanism for the client. What is the best way to do this? I'm new to web services and am confused by all the soap, wsdl etc. and have also heard a lot that it'll be a pain to get the two to communicate. Your thoughts?
Web Services are the one of the best approaches for interoperability over WEB. it's not that much difficult to create and use. It's as simple as Connecting to different databases and writing XML parsing in your code.
There are so many ways doing authentication. If you are using the IIS for deploying .net web services, then You can use Windows Authentication, Forms Authentication. These 2 are out of the box features of IIS. You can implement your custom authentication also. There are few compatible cryptography algorithms also for encrypting your data.
Without web services, it's very difficult to establish communication between Java ad .net.
You can give a try for JSON also. But i am not sure.
Hey check this video which gives you details. http://skillsmatter.com/podcast/java-jee/consuming-a-dot-net-web-service-using-java
I'd go for a simple REST interface using something like Jersey on the Java side, and a .Net JSON library to parse the data I consume.

Categories