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

Re: Returning attachments from server

Expand Messages
  • Duncan Cameron
    Is there a problem with a server class returning attachments? In my simple test the attachment is ignored. Only the OK value is returned to the client. use
    Message 1 of 2 , Oct 26, 2004
    • 0 Attachment
      Is there a problem with a server class returning attachments? In my
      simple test the attachment is ignored. Only the 'OK' value is returned
      to the client.

      use strict;
      use MIME::Entity;

      package Attachments;
      use vars qw(@ISA);
      @ISA = qw(Exporter SOAP::Server::Parameters);

      sub file {
      my $self = shift;
      my $envelope = pop;

      foreach my $part (@{$envelope->parts}) {
      print STDERR "attachment found! (".ref($part).")\n";
      print STDERR "contents => ". substr($part->stringify, 0, 100) . "\n";
      }
      my $ent = MIME::Entity->build(
      Type => "text/plain",
      Path => "fitch.t",
      Filename => "fitch.t",
      Disposition => "attachment"
      );
      return (SOAP::Data->type('', 'OK'), $ent);

      1;

      I have been looking at the code for SOAP::Lite and
      SOAP::Transport::HTTP and have some patches, so long as I have not
      misunderstood something.

      Using 0.65 beta 1

      Duncan
    • Byrne Reese
      Duncan, I thought I had tested this, but I think I need some more unit tests - because Duncan is right. Server side attachments don t seem to be working
      Message 2 of 2 , Oct 27, 2004
      • 0 Attachment
        Duncan,

        I thought I had tested this, but I think I need some more unit tests -
        because Duncan is right. Server side attachments don't seem to be
        working anymore. What a horrible oversight.

        Duncan, send me your patches, and I can get them integrated quickly.

        Byrne

        Duncan Cameron wrote:

        > Is there a problem with a server class returning attachments? In my
        > simple test the attachment is ignored. Only the 'OK' value is returned
        > to the client.
        >
        > use strict;
        > use MIME::Entity;
        >
        > package Attachments;
        > use vars qw(@ISA);
        > @ISA = qw(Exporter SOAP::Server::Parameters);
        >
        > sub file {
        > my $self = shift;
        > my $envelope = pop;
        >
        > foreach my $part (@{$envelope->parts}) {
        > print STDERR "attachment found! (".ref($part).")\n";
        > print STDERR "contents => ". substr($part->stringify, 0, 100)
        > . "\n";
        > }
        > my $ent = MIME::Entity->build(
        > Type => "text/plain",
        > Path => "fitch.t",
        > Filename => "fitch.t",
        > Disposition => "attachment"
        > );
        > return (SOAP::Data->type('', 'OK'), $ent);
        >
        > 1;
        >
        > I have been looking at the code for SOAP::Lite and
        > SOAP::Transport::HTTP and have some patches, so long as I have not
        > misunderstood something.
        >
        > Using 0.65 beta 1
        >
        > Duncan
      Your message has been successfully submitted and would be delivered to recipients shortly.