Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#140 SOAP::Packager::MIME does not unpack multipart entities

closed-fixed
Byrne Reese
Parsing (10)
5
2008-06-09
2008-02-14
Anonymous
No

Hi there,

I'm using SOAP::Lite to receive MMS messages sent by mobile phones which are transmitted by the 3GPP MM7 protocol. The messages use HTTP as the transport and MIME for packaging.

The structure of incoming MMS is as following:

multipart/related (the SOAP message)
\ text/xml (the SOAP envelope)
\_ multipart/related (the payload)
\ application/smil (the MMS script)
\ text/plain (some plain text)
\_ image/jpeg (some image data)

SOAP::Transport::HTTP happily receives the request, parses it into a SOAP::Packager::MIME object and unpacks it. SOAP::Packager::MIME identifies the outer MIME structure as "multipart/related" and accordingly calls $self->process_related($entity) on it.

process_related decides where a MIME entity has the Content-ID mentioned in the "start" attribute of the outer MIME structure, and either sets the SOAP envelope to the MIME entity's content, or puts the entity to the list of parts:

if ($start && $pid eq $start) {
$env = $part->bodyhandle->as_string;
} else {
$self->push_part($part) if (defined($part->bodyhandle));
}

However, adding the part with push_part only gets called if the part has a bodyhandle - which is not the case, if you look at the MIME structure above: process_related identifies the "text/xml" part as the start object, and the "multipart/related" part as "some other object" - but as multipart entities don't have bodyhandles, it doesn't get added to the list of attachments with push_part: It simply gets dropped, which in turn breaks the whole message, because the SOAP envelope references parts of the MIME message which aren't available.

I don't see a reason for checking if a part has a bodyhandle. From my point of view, the packager should simply add any other part to the list of SOAP attachments.

Could you please either tell me why there's a check for a bodyhandle, or include the attached patch into the next release?

Discussion

  • patch to make SOAP::Packager::MIME work with multipart attachments

     
  • Logged In: NO

    Here's a better picture of the MIME structure (missing whitespace in my original post makes it hard to understand):

    multipart/related (the SOAP message)
    -- text/xml (the SOAP envelope)
    -- multipart/related (the payload)
    -- -- application/smil (the MMS script)
    -- -- text/plain (some plain text)
    -- -- image/jpeg (some image data)

     
  • Martin Kutter
    Martin Kutter
    2008-02-29

    Logged In: YES
    user_id=884175
    Originator: NO

    Do you have a test message available ? It would be great for testing.

    Martin

     
  • Martin Kutter
    Martin Kutter
    2008-06-09

    Logged In: YES
    user_id=884175
    Originator: NO

    Applied in SVN, will be in next release.

    Thanks,

    Martin

     
  • Martin Kutter
    Martin Kutter
    2008-06-09

    • status: open --> closed-fixed