Dear Javaranch members,
I am new to java and Webservices.
I am working on a university project to connect test instruments and get request and response from it using webservice.
I have to request more than one service from the instrument, but when i use more than two @Get in the server, i get an error in browser saying "Cannot access WADL, please restart your restful webservice"
This is my code,
@GET
@Produces("text/html")
public String getHtml() {
String ins_name=null;
try {
String [] env=null;
//setting the environment variable.
String[]callAndArgs= {"python","instrument_name.py"};//python and file name
Process p = Runtime.getRuntime().exec(callAndArgs,env,
new java.io.File("C:\\Users\\Balkishore\\Documents\\NetBeansProjects\\DemoApp1\\build\\web"));//excuting python file
@GET
@Produces("text/html")
public String getHtml1() {
String check=null;
String c1="hjhj";
String [] env=null;
//setting the environment variable.
try{
String[]callAndArgs= {"python","check_connection.py",c1};//python and file name
Process p = Runtime.getRuntime().exec(callAndArgs,env,
new java.io.File("C:\\Users\\Balkishore\\Documents\\NetBeansProjects\\DemoApp1\\build\\web"));//excuting python file
/**
* PUT method for updating or creating an instance of GenericResource
* @param content representation for the resource
* @return an HTTP response with content of the updated or created resource.
*/
@PUT
@Consumes("text/html")
public String putHtml(String interface_name) {
try {
String [] env=null;
String[]callAndArgs= {"python","connection.py",this.interface_name=interface_name};//python file with agruments
Process p = Runtime.getRuntime().exec(callAndArgs,env,
new java.io.File("C:\\Users\\Balkishore\\Documents\\NetBeansProjects\\DemoApp1\\build\\web"));//excuting the python file
Thank you very much for replying.
Please excuse my stupidity as i am very much new to java and netbeans, i couldn't get what you meant there?
What can i do in the code to create a new URL? do i have to create a new path? if so how would i do it?
Tim Moores
Rancher
Joined: Sep 21, 2011
Posts: 2407
posted
0
I'd say you're missing a couple of @Path annotations. As it is, how is the WS engine supposed to decide between the two methods handling GET?
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12265
1
posted
0
What I was talking about is a REST concept, not a Java and certainly not a NetBeans concept.