walshy has asked for the wisdom of the Perl Monks concerning the following question:

I've been using SOAP::Lite, with very good results so far, to emulate some terminals that use SOAP to connect to a server.
I now need to add in heartbeat functionality.
I've found a problem with the server not always responding to heartbeats. I've raised this with the devs, but as the terminal I'm simulating copes with this, I need to be able to cope too. Thing is, SOAP Lite's "call" blocks for (or at least that's how I'm reading it) a response and the occasions when I get no response cause me to crash. Message gen code:
my $heartbeat = SOAP::Lite->new(proxy => $proxy); $heartbeat->default_ns('lws:Heartbeat'); $heartbeat->autotype(0); $heartbeat->transport->timeout(1); $self->heartbeat($heartbeat); my $state = 1; my (@hbArgs) = ( SOAP::Data->name( 'deviceName' => $self->{id} ), SOAP::Data->name( 'username' => $self->{userName} ), SOAP::Data->name( 'sessionId' => $self->sessInfo->{sessionI +d} ), SOAP::Data->name( 'state' => $state ), SOAP::Data->name( 'taskId' => $self->{taskId} ), SOAP::Data->name( 'location' => ''), ); my (@obj) = SOAP::Data->name( 'obj' => \SOAP::Data->value( @hbArgs, ), ); my (@message) = SOAP::Data->name( 'message' => \SOAP::Data->value( @obj, ), ); print "Let's try\n"; $self->call( "heartbeat", "sendPulse", \@message); print "WE're back!!\n";
and my call:
sub call { my ($self, $handle, $cmd, $params) = @_; if($cmd eq "sendPulse") { # Don't need to do anything with the heartbeat response $self->TOOLS::Print::sending("Sending heartbeat"); $self->{$handle}->call( $cmd, @{$params} ); return $self->{call}; } $self->callResp($self->{$handle}->call( $cmd, @{$params} )); if($cmd ne "login")
Output:

SENDING HEARTBEAT
$proxy = 'http://128.0.100.135:14901';
Let's try
500 read timeout at /usr/users/stevew/Testing/Director/perl5/../lib/HHT.pm line 278
Line 278 being (from above):

$self->{$handle}->call( $cmd, @{$params} );
Is there a way to send a SOAP message using SOAP::Lite and not expect a response?

Replies are listed 'Best First'.
Re: Handle sending SOAP::Lite call which may not get a response
by afoken (Chancellor) on May 21, 2015 at 08:37 UTC
    Is there a way to send a SOAP message using SOAP::Lite and not expect a response?

    SOAP (as you use it) runs on top of HTTP(S), so there must be a response. That's how HTTP works.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)