Problem with calling web process

Hello I try to use one of web service(web service only add two numbers and return the result), which JOpera have deployed on http://localhost:8080/wsdl
I call it from Java but I have exception: "Execution failed. Exception: (400)HTTP+method+POST+is+not+supported+by+this+URL"

My Java code to call the web service look like this:

try {
String endpoint = "http://localhost:8080/wsdl?process={ws.localhost.axis.AddFunction.jws}Scitacka[1.0]";
Service service = new Service();
Call call = (Call) service.createCall();
call.setOperationName(new QName(endpoint, "ScitackaRequest"));
call.setTargetEndpointAddress(new java.net.URL(endpoint));
Integer ret = (Integer) call.invoke(new Object[] { new Integer(5), new Integer(6) });
System.out.println("addInt(5, 6) = " + ret);
} catch (Exception e) {
System.err.println("Execution failed. Exception: " + e);
}

Can you please help me
thanks for any help

Wrong Endpoint

Hello,
your client is using the URL of the WSDL instead of the URL of the service for the endpoint.

You should try with:

String endpoint = "http://localhost:8080/services/{ws.localhost.axis.AddFunction.jws}Scitacka[1.0]";

or whatever endpoint URL you find inside the WSDL of the process published as Web service.

Let us know if this helps.

You should also try out the new JOpera REST API.

Best Regards,
JOpera Support

Problem with process published as Web Service

Hello

Now is the problem that the procces (procces only add two int number and return result as int) in JOpera has as input two int values and return int value. But when the web service ist published on http://localhost:8080/wsdl the wsdl for this procces has this inputs defined as String and it doesn't work. Why the published web service has defined another types ?

Do you know what is the problem ?

Thanks for your bug report

The current JOpera2WSDL generator only supports String data types, no matter what types you specify in your process, the WSDL will contain String parameters.

Let us know if you would urgently require a fix for this bug.

Many thanks for your feedback
JOpera Team

Rest Service

Ok, for me is better calling the wsdl as rest, but i can call rest too.
I have one question
How can I call you rest services on http://localhost:8080/rest from classic java enviroment ?

Java Client Example

This example should be used in conjunction with the dag.oml example. It will call the DAG process through the new JOpera REST API and wait for it to finish before it prints out its output. The URL points to the DAG process and the execution time of its tasks is passed as input parameter.

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;


public class JOperaClient {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
	//setup the URL of the process to run
		URL url = new URL("http://localhost:8080/rest/dag/DAG/1.0/");
			
	//input parameter values should be CGI-URL Encoded
	        String output = callProcess(url, "time=1234");

        //this will contain the ID, final state of the process, and its output parameter values
	        System.out.println(output);
			
		} catch (MalformedURLException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	private static String callProcess(URL url, String input) throws IOException {

	//synchronous blocking calls (where the response arrives once the process has finished)
		if (input != null & input.length()>0)
			input = "Action=run&" + input;
		else
			input = "Action=run";
		
	// Send the request
		URLConnection conn = url.openConnection();
		conn.setDoOutput(true);
		OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
		wr.write(input);
		wr.flush();
   
	// Wait to read the response
		String output = "";
		String line;
		BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
		while ((line = rd.readLine()) != null) {
		    output += line + "\n";
		}
		wr.close();
		rd.close();
		return output;
	}

}

parameter to REST service

Hello JOpera team

I have question about parameter on your REST service, which are automatic deployed on http://localhost:8080/rest/ . For example if i use the rest service with parameter on the url

http://www.webservicex.net/stockquote.asmx/GetQuote?symbol="symbol"

I became normal answer on this request. Is it possible too with your REST service ? Only manual add parameter to the URL and get result ?

thanks for any answer

Not 100% RESTful

Hi there,

Starting a process instance in response to a GET request is not RESTful (violates the idempotency constraint) so it is not supported.

If you would like to extract URI parameters from within a running process, try to add a task invoking a program bound to the REST.RECEIVE adapter. You can configure the adapter with a URI (like /stockquote.asmx/GetQuote and the GET method and define the URI query parameters (symbol) as output parameters of the program. The task will block until a GET http://localhost:8080/stockquote.asmx/GetQuote?symbol=X request arrives.

Best Regards,
JOpera team