-3

I am developing a video search engine for my research in the campus. It is semantic based search engine. I use JavaEE for my backend and I suppose to use php for my front end development. But I want to keep these two as separate web applications and make communication between them. How can I do that, I want to pass data between php to javaEE using web services.

I wrote a code from javaEE to get user inputs and give the output for matching words as json.It is works fin with postman but i want to get those inputs from web page.

@POST
@Path("/setItem")
@Consumes(MediaType.TEXT_PLAIN)
//@Produces(MediaType.APPLICATION_JSON)
public Response getResultForTypedQuery(String item){

    initializeOntologyModel();

    System.out.println(item);

    JSONObject getResultJSON = new JSONObject();

    OntologyRelationship OR = new OntologyRelationship();
    getResultJSON = OR.OntologyAsJSON(item,model,URI);

    ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
    String JSONobjectConverted = null;

    try {
        JSONobjectConverted = ow.writeValueAsString(getResultJSON).toString();
    } catch (JsonProcessingException e) {
        e.printStackTrace();
    }

    return Response.status(200).entity(JSONobjectConverted).build();

}
  • Hey see what I found. This will take you inside out of PHP. Check it here http://php.net/manual/en/intro-whatis.php http://php.net/manual/en/intro-whatcando.php – Talha Malik Jun 06 '16 at 07:53
  • 1
    web services is a good idea, since the WS idea is to be language agnostic. If you expose the JavaEE WS as RESTful methods, it's probably easy to implement some kind of client using PHP in the front end. BTW you can check this http://stackoverflow.com/questions/3350231/how-can-i-communicate-between-php-and-a-java-program – Leo Jun 06 '16 at 07:58

1 Answers1

1

First PHP is not for front end development. But if you meant to develop two applications one in PHP and second in Java and somehow communicate between the two you can check PHP/Java Bridge. I am not sure how updated it is, I used in couple of years ago but hope it will help you.

Talha Malik
  • 1,509
  • 3
  • 22
  • 44