-
1. Re: Interface from C app to Seam?
raja05 Sep 9, 2006 12:23 AM (in response to chuaky)1. Web Services maybe a good way to do this, you dont have to use Seam for that, but just generally have an endpoint that can receive your WS calls and act on it. Why do you have to use Seam for this?
2. Use JMX. If you have an JMX enabled bean, you could use the twiddle script (look up in jboss-4.0.x/bin/twiddle.sh) to invoke an mbean (get/set attribute, call methods etc) but that would be one more technology to learn :( -
2. Re: Interface from C app to Seam?
chuaky Sep 10, 2006 8:21 AM (in response to chuaky)Thanks Raja for the advice. I'm building a web app using seam + portal + facelets, so i wanted the C app to interface with the java beans written in seam.
Sorry, i'm a newbie so some of the terms may be incorrectly used.
Cheers. -
3. Re: Interface from C app to Seam?
shane.bryzak Sep 10, 2006 7:36 PM (in response to chuaky)Remoting was built for exactly this scenario, and even though we only provide a Javascript implementation of the remoting client, there is nothing stopping anyone from building a C (or whatever) client that integrates with the remoting servlet. It uses a simple XML-based structure for its protocol, and does all the work of setting up the Seam request (creating contexts, resuming conversations, etc) for you.
If you implement your remote methods then test them first using Javascript, you can turn on debug mode to see the contents of the request and response packets. It should then be a pretty simple exercise to re-create the same request structure in C. -
4. Re: Interface from C app to Seam?
cptnkirk Sep 10, 2006 8:06 PM (in response to chuaky)Not to knock the work done by the remoting team, but is there a reason a custom protocol was chosen vs a Seam RemotingEndpoint that would handle remoting via some version of SOAP?
I would have a thought the benefits of a standard transport protocol would outweigh the down side. Since obviously they did not, what are the benefits of this approach? -
5. Re: Interface from C app to Seam?
shane.bryzak Sep 11, 2006 1:52 AM (in response to chuaky)"CptnKirk" wrote:
Not to knock the work done by the remoting team, but is there a reason a custom protocol was chosen vs a Seam RemotingEndpoint that would handle remoting via some version of SOAP?
I would have a thought the benefits of a standard transport protocol would outweigh the down side. Since obviously they did not, what are the benefits of this approach?
SOAP was too heavy-weight for my taste; instead I chose to implement the remoting protocol based loosely on the XML-RPC spec, with some minor changes to how object references were handled and the inclusion of a request context to carry additional stuff like the conversation ID. The intent was to make the protocol as lightweight and simple as possible to both keep network traffic minimal and to make it easy to implement remoting clients in other languages (ActionScript, etc).
As a side note, there is a more comprehensive web services strategy in the works for Seam which will enable calling Seam components via SOAP. -
6. Re: Interface from C app to Seam?
cptnkirk Sep 11, 2006 2:40 AM (in response to chuaky)What I figured. Thanks. Any plans to publish a protocol spec?
-
7. Re: Interface from C app to Seam?
shane.bryzak Sep 11, 2006 7:41 AM (in response to chuaky)"CptnKirk" wrote:
What I figured. Thanks. Any plans to publish a protocol spec?
I was actually thinking just the other day that it would be a good idea to document this stuff, so yeah it's on my list of things to do now :) -
8. Re: Interface from C app to Seam?
chuaky Sep 14, 2006 11:05 AM (in response to chuaky)dear all,
I end up using seam remoting method. The following is an example of what i did.
Cheers.
java -cp . Reverse http://localhost:8080/seam-helloworld/seam/remoting/execute "<call component=\"helloAction\" method=\"sayHello\" id=\"0\">hjhj"
Reverse class:
==========
import java.io.*;
import java.net.*;
public class Reverse {
public static void main(String[] args) throws Exception {
if (args.length != 2) {
System.err.println("Usage: java Reverse " +
"http://<location of your servlet/script>" +
" string_to_reverse");
System.exit(1);
}
String stringToReverse = args[1];
URL url = new URL(args[0]);
URLConnection connection = url.openConnection();
connection.setDoOutput(true);
connection.setRequestProperty("Content-Type","text/xml");
connection.setDoInput(true);
OutputStreamWriter out = new OutputStreamWriter(
connection.getOutputStream());
out.write(stringToReverse);
out.close();
BufferedReader in = new BufferedReader(
new InputStreamReader(
connection.getInputStream()));
String decodedString;
while ((decodedString = in.readLine()) != null) {
System.out.println(decodedString);
}
in.close();
}
} -
9. Re: Interface from C app to Seam?
chuaky Sep 14, 2006 11:09 AM (in response to chuaky)some text was cut off in the reply. If you need do combine them without any carriage return. You can also see this similar trace when you run the remoting seam example.
java -cp . Reverse http://localhost:8080/seam-helloworld/seam/remoting/execute
"
<call component=\"helloAction\" method=\"sayHello\"
id=\"0\">hjhj
" -
10. Re: Interface from C app to Seam?
chuaky Sep 14, 2006 11:11 AM (in response to chuaky)i guess the text is still cutoff, if anybody need them, please capture the trace from running remoting example. Cheers.
-
11. Re: Interface from C app to Seam?
chuaky Sep 14, 2006 11:45 AM (in response to chuaky)sorry for the multiple posts, the input arg is as follows. please add the \ escape character before the " character inside the quotes. Cheers.
java -cp . Reverse http://localhost:8080/seam-helloworld/seam/remoting/execute "hjhj"