I have an application with php at front end and Java as Backend. I was using Hessian from php to call Java methodes with returns data from Java to php. and now i got some problem with hessian and I am getting some exception u can see the question i posted earlier. https://stackoverflow.com/questions/11121340/hessianserviceexporter-only-supports-post-requests
Is there any other method to call java functions from php code, just like hessian?
If so can someone tell me know?
Easiest way would be to implement a REST layer using JAX-RS. Apache CXF is an excellent, very simple system for deploying JAX-RS services. You can build out the entire service layer without having to worry about Java/PHP interaction that way.
To give you an idea of how easy it is:
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
public class DemoService {
@GET
@Path("sayHello")
@Produces(MediaType.TEXT_PLAIN)
public String sayHello() { return "Hello, world!"; }
}
The content of the beans.xml for CXF's servlet would look like this:
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
<jaxrs:server id="demoService" address="/demoService">
<jaxrs:serviceBeans>
<ref bean="serviceBean"/>
</jaxrs:serviceBeans>
</jaxrs:server>
<bean id="serviceBean" class="com.company.DemoService"/>