Hi Christian,
I have a set of RESTXQ functions both updating and not, defined by a low-level REST specification, and this is my original configuration.
Now I have to wrap them with equivalent SOAP calls that come from another specification but the native functions need to remain accessible through REST. 
I'd like to do the WSDL queries, the validation of the SOAP request and finally the routing to the native functions by just adding only one single  generic RESTXQ function. This code will access only filesystem resources and it won't be updating for sure.
Since I don't want to make everything "updating", because I dont want to introduce unnecessary synchronization, I'd like to just call the native functions through the forwarding mechanism passing ahead the POST content of the request and exploiting the nice declarative way of routing with parametric path annotations.
According to the optionality of the postbody parameter it works when I call a RESTXQ function directly. It also works when forwarding if the orignal HTTP request doesn't have any postbody. But when the postbody is there in the original request, the subsequent function (where I forward to) yields the error.

Of course I'm also ready to accept architectural suggestions if this can satisfy my needs ;-)

Here is a code snippet that should reproduce the error on 7.7.2. Both the plain version plus the one that uses the session trick.
Hope this helps.
Regards.

module namespace soapskel = 'urn:myns';
import module namespace session = "http://basex.org/modules/session";
declare
        %rest:path("test")
        %rest:POST("{$postbody}")
        %output:method("xml")
function soapskel:test($postbody){
    (: do all SOAP related work here :)
    <rest:forward>{
        "test/impl"
    }</rest:forward>
};
declare
        %rest:path("test2")
        %rest:POST("{$postbody}")
        %output:method("xml")
function soapskel:test2($postbody){
    (: do all SOAP related work here :)
    let $id := (session:id(), session:set('data',$postbody))
    return
    <rest:forward>{
        "test/impl"
    }</rest:forward>
};
declare
        %rest:path("test/impl")
        %rest:POST("{$postbody}")
        %output:method("xml")
function soapskel:impl($postbody){
    if (empty($postbody)) then
        session:get('data')
    else
        $postbody
};

On 01/14/2014 01:38 PM, Christian Grün wrote:
Hi Marco,

an introductory question: what’s your particular reason for splitting
the operation in two parts? Do you perform database updates in the
pre-validation step?

It works nicely up to the access to the POST content which appears to be
consumed defintely by the first function.
That’s right: POST bodies can only be consumed once. We could think
about extending the rest:forward-Syntax in order to construct a new
body, but that’s just an idea (and I’m not sure if this is supported
by the Java request dispatcher).

Moreover there
is no possibility of stating that the postbody may possibly be empty, is it?
This should generally be possible. I have tried the following RESTXQ function:

declare %rest:path("/post") %rest:POST("{$x}") function rest:main($x) { $x };

It doesn’t trigger an error when calling it with:

  curl -XPOST -i "http://localhost:8984/post"

Could you provide me with a little example of your code that causes the problem?
Christian