On Thu, Apr 18, 2002 at 05:01:44PM -0400, Peter Chen wrote:
> I have been working with Fletch's POE::Component::SOAP. It's wonderful
> to be able to get a SOAP server up and running with very little code.
>
> I am tripping over some conceptual issues with the synchronouse calls.
> Perhaps some of you who are more familiar with POE paradigm can
> enlighten me.
>
> Currently PoCo::SOAP makes a synchronous SOAP::Server::handle call to
> deal with the SOAP requests. I am wondering how to make it more POE
> compliant, perhaps some how breaking this up in a fashion similar to
> PoCo::SubWrapper. It's not obvious to me how to go about this.
>
> Here is an extract of the function that handles incoming requests.
>
> sub got_req {
> my( $self, $heap, $input, $wheel_id ) = @_[ OBJECT, HEAP, ARG0, ARG1
> ];
>
> $input .= '</SOAP-ENV:Envelope>';
>
> my $response = $self->{_dispatch}->handle( $input );
>
> $self->{_wheel}->put( $response );
> }
This may be fine depending on what handle($input) does. I wouldn't
worry about breaking up handle() if it's quick, for instance.
In situations where handle() takes a long time, it depends on the
application. If SOAP servers can cope with large latencies, having
handle() delay and block is not so bad.
> It seems that it may be necessary to move
>
> $self->{_wheel}->put( $response );
>
> to another state, got_resp, after the result of the SOAP call is
> available. I am somewhat at loss regarding the next step.
This is true if handle() will take a long time and you'd like to run
other handlers in the meantime. In that case, handle() can either be
rewritten to work in POE-like ways, or it can be forked off into a
child process with IPC::Run or POE::Wheel::Run.
In the POE-like case, the last function to handle $input would call
some high-level response function like return_response($result).
In the forked-child case, whatever the child process prints would be
automatically returned vias $self->{_wheel}->put( $response );
However, since SOAP works over HTTP, I'm led to believe that it's a
synchronous RPC protocol. The application seems to lend itself to
either the first or third solution (blocking handle() or forking).
I'm probably not the best person to advise you about SOAP servers,
though.
-- Rocco Caputo / [EMAIL PROTECTED] / poe.perl.org / poe.sf.net