There are different ways how to make a request in Java. Considering Restlet framework:
// Prepare the data for the request String tp = "http://nb.vse.cz/~svabo/patomat/tp/tp_hasSome2.xml"; String binding = "<pattern_instance><binding placeholder='?p'>hasDecision</binding><binding placeholder='?B'>Decision</binding><binding placeholder='?A'>Paper</binding><binding placeholder='?C'>Rejection</binding></pattern_instance>"; Representation entity = new StringRepresentation("tp="+tp+"&ontology+"ontology", MediaType.TEXT_XML); // Prepare the request ClientResource resource = new ClientResource("http://owl.vse.cz:8080/ontologyTransformation/detection"); // Send the HTTP POST request resource.post(entity); //Do what you want with a response, e.g.: resource.getResponseEntity().write(System.out);
Considering Java standard library, an HTTP client, the code snippet would be as follows:
// Prepare the data for the request NameValuePair[] data = { new NameValuePair("tp", "http://nb.vse.cz/~svabo/patomat/tp/tp_hasSome2.xml"), new NameValuePair("binding", "<pattern_instance><binding placeholder='?p'>hasDecision</binding><binding placeholder='?B'>Decision</binding><binding placeholder='?A'>Paper</binding><binding placeholder='?C'>Rejection</binding></pattern_instance>") }; // Prepare the request HttpClient client = new HttpClient(); PostMethod post = new PostMethod("http://owl.vse.cz:8080/ontologyTransformation/instructions"); post.setRequestBody(data); // Execute the method. int statusCode = client.executeMethod(post); //Do what you want with a response, e.g.: InputStream in = post.getResponseBodyAsStream();