Hi,

after I finally ditched SOAP (of course, Google had to imitate me ;)) I
decided to use simple webservices using HTTP POST.

Frankly, the client should simply POST the command using HTTP and
receive an answer.

As I understand it, I'll have to simulate a submission using the
client. My first simple tries were in vain so I used a sniffer to look
at the traffic for the number guess game and I'm pretty confused now:

submission=performGuess&submissioncontext=VERY_LONG_STRING&guess=4

Is this submission context really necessary? How can I simulate him? Is
there some easier way I'm missing?

Ideally, the Element should just look something like this:

--8<---------------cut here---------------start------------->8---
public class Rest extends Element {
    public void processElement() {
        if (hasSubmission()) {
            Foo.process(getSubmission());
        }
}
--8<---------------cut here---------------end--------------->8---

What I've tried:
--8<---------------cut here---------------start------------->8---
<element id="REST" url="/rest" implementation="my.impl">
        <submission name="call">
            <param name="script" />
        </submission>
</element>
--8<---------------cut here---------------end--------------->8---

and:

--8<---------------cut here---------------start------------->8---
public class Rest extends Element {
    public void processElement() {
        System.out.println("inside");

        if (hasSubmission("call")) {
            System.out.println("submission");
        }
    }

    public void doCall() {
        System.out.println("foo");
    }
}
--8<---------------cut here---------------end--------------->8---

Then I try to call it using:

--8<---------------cut here---------------start------------->8---
PostMethod post = new PostMethod("http://localhost:8080/rest";);

RequestEntity ent = new StringRequestEntity("submission=call&script=bar", 
"application/x-www-url-encoded", "utf8");
post.setRequestEntity(ent);

HttpClient httpclient = new HttpClient();

int result = httpclient.executeMethod(post);
System.out.println("Response status code: " + result);
--8<---------------cut here---------------end--------------->8---

I get a 200 back, `inside' is printed but `submission and `foo' not.

I'm pretty sure I'm missing something obvious...any hints?

TIA,
-hs
_______________________________________________
Rife-users mailing list
Rife-users@uwyn.com
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to