The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

POE::Component::Client::SOAP

SYNOPSIS

# (1) Derive you own client class

package My::SOAP;

use base qw(POE::Component::Client::SOAP);

sub spawn{

  my $package = shift;
  my $proxy = shift;
  my $service = shift;
  my $self = $class->SUPER::spawn(
       retry_reconnect => 1,
       proxy => $proxy,
       service => $service,
  );

  # initialized flag
  $self->{soc_stat} = 0;
  return $self;
}

# override connected method for status, for example
sub handle_connected {
  my ($kernel, $self, $frame) = @_[KERNEL,OBJECT,ARG0];

  # marks stomp client as initialized
  $self->{soc_stat} = 1;
}

# this must be overriden; it's the result from the call
sub handle_result {
  my ($kernel, $self, $result) = @_[KERNEL,OBJECT,ARG0];
  # post to your session, or do whatever with SOAP result....
  $kernel->post($your_session, $call_back_event, $result);
  # result contains the SOAP call name and data
}

# usually overriden
sub log {
  my ($self, $kernel, $level, $message) = @_;
}

sub handle_error {
  my ($kernel, $self, $result) = @_[KERNEL,OBJECT,ARG0];
  $self->{soc_stat} = 0;
  $kernel->post($your_session,$error_call_back_event, $result);
  # result contains the SOAP call name and error data
}


# (2) use it in the actual implementation

use My::SOAP;

my $soap = My::SOAP->spawn(
  proxy => 'http://your.soap.server',
  service = > 'http://your.soap.server/service.wsdl',
)

$soap->soapCall(params);

...

sub call_back_event_handler{
  my ( $self, $kernel, $session, $soc_ret ) = @_[ OBJECT, KERNEL, SESSION, ARG0 ];
  $call  = $soc_ret->[0]; # which SOAP call is returning
  $data  = $soc_ret->[1]; # the data of the SOAP return
}

DESCRIPTION

This module is a non-blocking wrapper around SOAP::Lite for POE. As any non-blocking wrapper it needs to spawn a dedicated process to deal with the blocking SOAP calls. As with most non-blocking wrappers we used PoCo::Generic for abstracting all the details of the dedicated process and it's events. Nevertheless, because we use PoCo::Generic, it is mandatory to know all the SOAP methods beforehand, hence the need to require a service descriptor (WSDL) to work with this library.

If you have a particular need to use SOAP WITHOUT WSDL, please drop a line a we'll see what we can do to help you.

SEE ALSO

SOAP::Lite

POE::Component::Server::AsyncEndpoint::ChannelAdapter::SOAP POE::Component::Server::AsyncEndpoint::ChannelAdapter::Stomp

POE::Component::Server::AsyncEndpoint POE

AUTHOR

Alejandro Imass <ait@p2ee.org> Alejandro Imass <aimass@corcaribe.com>

COPYRIGHT AND LICENSE

Copyright (C) 2008 by Alejandro Imass / Corcaribe Tecnología C.A. for the P2EE Project

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 538:

Non-ASCII character seen before =encoding in 'Tecnología'. Assuming UTF-8