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

SOAP::MIME - Patch to SOAP::Lite to add attachment support. This module allows Perl clients to both compose messages with attachments, and to parse messages with attachments.

Currently the module does not support server side parsing of attachments... at least it has never been tested.

SYNOPSIS

SOAP::Lite (http://www.soaplite.com/) is a SOAP Toolkit that allows users to create SOAP clients and services. As of July 15, 2002, MIME support in SOAP::Lite was minimal. It could parse MIME formatted messages, but the data contained in those attachments was "lost."

This Perl module, patches SOAP::Lite so that users can not only send MIME formatted messages, but also gain access to those MIME attachments that are returned in a response.

TODO/ChangeLog

6/12/2002 - Need to add ability to compose and send attachments. FIXED on 7/15/2002 7/15/2002 - Ability to process attachments on the server side has not yet been tested. 7/26/2002 - Reworked the parsing of the response to return an array of MIME::Entity objects which enables to user to more fully utilize the functionality contained within that module

REFERENCE

SOAP::SOM::attachments()

DEPRECATED - please use SOAP::SOM::parts instead which stores an array of MIME::Entity objects

Used to retrieve attachments returned in a response. The subroutine attachments() returns a hash containing the attachments parsed out of a message. The keys to the returned hash is the content-id of the associated attachment. The value of the hash is an array containing the content-type, the ???, and the content of the attachment itself:

@(<content-type>,%HASH,<content>)

SOAP::SOM::parts()

Used to retrieve MIME parts returned in a response. The subroutine parts() returns a reference to an array of MIME::Entity objects parsed out of a message.

SOAP::Lite::parts(ARRAY)

Used to specify an array of MIME::Entities. These entities will be attached to the SOAP message.

EXAMPLES

Retrieving an Attachment

  use SOAP::Lite;
  use SOAP::MIME;

  my $soap = SOAP::Lite
    ->readable(1)
      ->uri($NS)
        ->proxy($HOST);
  my $som = $soap->foo();

  foreach my $part (${$som->parts}) {
    print $part->stringify;
  }

Sending an Attachment

  use SOAP::Lite;
  use SOAP::MIME;
  use MIME::Entity;

  my $ent = build MIME::Entity
    Type        => "image/gif",
    Encoding    => "base64",
    Path        => "somefile.gif",
    Filename    => "saveme.gif",
    Disposition => "attachment";

  my $som = SOAP::Lite
    ->readable(1)
    ->uri($SOME_NAMESPACE)
    ->parts([ $ent ])
    ->proxy($SOME_HOST)
    ->some_method(SOAP::Data->name("foo" => "bar"));

SEE ALSO

SOAP::Lite, MIME::Entity