Loading ...
Sorry, an error occurred while loading the content.

Re: [soaplite] Attachments without Packager

Expand Messages
  • Byrne Reese
    ... This is the recommended way: http://www.majordojo.com/soaplite/docs/SOAP/Packager.html#SOAP%3A%3APackager%3A%3AMIME #!/usr/bin/perl use SOAP::Lite; use
    Message 1 of 2 , Feb 10, 2005
    • 0 Attachment
      bezyan2 wrote:

      > Since the documentation for SOAP::Packager (on CPAN) indicates that
      > the "package" attribute is essentially deprecated, what is an
      > alternative method to attaching files?

      This is the recommended way:
      http://www.majordojo.com/soaplite/docs/SOAP/Packager.html#SOAP%3A%3APackager%3A%3AMIME

      #!/usr/bin/perl
      use SOAP::Lite;
      use MIME::Entity;
      my $ent = build MIME::Entity
      Type => "text/plain",
      Path => "attachment.txt",
      Filename => "attachment.txt",
      Disposition => "attachment";
      $NS = "urn:Majordojo:TemperatureService";
      $HOST = "http://localhost/cgi-bin/soaplite.cgi";
      my $client = SOAP::Lite
      ->packager(SOAP::Packager::MIME->new)
      ->parts([ $ent ])
      ->uri($NS)
      ->proxy($HOST);
      $response = $client->c2f(SOAP::Data->name("temperature" => '100'));
      print $response->valueof('//c2fResponse/foo');


      > I currently follow the existing online SOAP::Lite examples which
      > create a MIME entity, attach via the parts() method, and rely in
      > SOAP::Packager::MIME to deal with on server side of things.
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.