#102 Server does not return MIME attachments

open
nobody
None
6
2007-10-04
2006-04-03
Anonymous
No

This was first discussed (very briefly) on the mailing
list sometime last year and a "fix" was implied, but I
do not believe it has been incorporated yet. I am
running .67, installed on 2006-04-02.

The problem is that the method given for having a
server return a file does seem to work.

sub service
{
my @parms = @_;

my $ent = MIME::Entity->build {
....
};

my $foo = "Result";

return($foo,$ent);
}

I have tried everything that I can think of, including
a return statement like:

return ( SOAP::Data->name( foo => "Result"
),SOAP::Data->name( file => $ent ) );

withpout success.

Anything to make this work would be a great help.

Jim Bacon
boftx@hotmail.com

Discussion

  • Vorik

    Vorik - 2006-08-07

    Logged In: YES
    user_id=1336605

    I'm having the same problems.

    Ger.
    g.apeldoorn@argoss.nl

     
  • Nobody/Anonymous

    Logged In: NO

    me too.

    jkhavich@yahoo.com

     
  • Randy Dey-Toth

    Randy Dey-Toth - 2006-09-18

    Logged In: YES
    user_id=524545

    I was having the same problem, with version .68, and then
    also with .69. I got it to work my modifying the code
    slightly for Lite.pm and Packager.pm. Whether these
    modifications break anything else I'm not sure, but
    everything seems to work just fine with them.

    Patch for Lite.pm:

    1451a1452
    > my $pushed = 0; # RDT
    1460a1462
    > $pushed = 1; # RDT
    1554c1556
    < # return
    $self->context->packager->package($self->xmlize($encoded));
    ---
    > return
    $self->context->packager->package($self->xmlize($encoded))
    if $pushed; # RDT -- uncommented on if.

    Patch for Packager.pm:

    157c157,158
    < return $top->stringify_body;
    ---
    > # return $top->stringify_body; # RDT
    > return $top->stringify; # RDT

     
  • Martin Kutter

    Martin Kutter - 2007-10-04
    • priority: 5 --> 6
     
  • Stanislav Oginsky

    Is there any plans\estimates or workaround for this issue?

    Is it safe to use following patch for 0.712 version:

    --- ./SOAP/Lite.pm
    +++ ./SOAP/Lite.pm
    @@ -1513,6 +1513,7 @@
    SOAP::Trace::trace('()');
    my $self = shift->new;
    my $type = shift;
    + my $is_mime = 0;
    my(@parameters, @header);
    for (@_) {
    # Find all the SOAP Headers
    @@ -1524,6 +1525,7 @@
    && $self->context->packager->is_supported_part($_)
    ) {
    $self->context->packager->push_part($_);
    + $is_mime = 1;
    }
    # Find all the SOAP Body elements
    else {
    @@ -1639,9 +1641,9 @@
    # Sometimes SOAP::Serializer is invoked statically when there is no context.
    # So first check to see if a context exists.
    # TODO - a context needs to be initialized by a constructor?
    - if ($self->context && $self->context->packager->parts) {
    + if ($self->context && $self->context->packager->parts && $is_mime) {
    # TODO - this needs to be called! Calling it though wraps the payload twice!
    - # return $self->context->packager->package($self->xmlize($encoded));
    + return $self->context->packager->package($self->xmlize($encoded));
    }

    return $self->xmlize($encoded);
    --- ./SOAP/Packager.pm
    +++ ./SOAP/Packager.pm
    @@ -154,7 +154,7 @@
    # determine MIME boundary
    my $boundary = $top->head->multipart_boundary;
    $self->headers_http({ 'Content-Type' => 'Multipart/Related; type="text/xml"; start="<main_envelope>"; boundary="'.$boundary.'"'});
    - return $top->stringify_body;
    + return $top->stringify;
    }

    sub unpackage {
    --- ./SOAP/Transport/HTTP.pm
    +++ ./SOAP/Transport/HTTP.pm
    @@ -486,7 +486,7 @@
    && $encoding ? 'charset=' . lc($encoding) : () ),
    'Content-Length' => SOAP::Utils::bytelength $response
    ),
    - ( $] > 5.007 )
    + ( $] > 5.007 && $encoding)
    ? do { require Encode; Encode::encode( $encoding, $response ) }
    : $response,
    ) );

     

Log in to post a comment.