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

Problem + solution: sending attachments using SOAP::MIME

Expand Messages
  • krishnan_anantheswaran@yahoo.com
    Hi, I m trying to send a multipart/related SOAP message with an attachment to a webservice (implemented in Java using Apache Axis). (I know that this is not
    Message 1 of 2 , Apr 7, 2004
    • 0 Attachment
      Hi,

      I'm trying to send a multipart/related SOAP message with an
      attachment to a webservice (implemented in Java using Apache Axis).

      (I know that this is not *officially* supported by SOAP::MIME but it
      seems to be pretty close - read on).

      The server croaks in trying to parse the message.

      The reason, I found, was that the MIME::Entity uses "\n" as the
      boundary delimiter and the Java code (Axis) expects "\r\n" as the
      boundary delimiter.

      If I fix the print_body sub in MIME::Entity as so, this actually
      works:

      === start ===

      foreach $part ($self->parts) {
      $out->print("--$boundary\r\n"); #Krishnan:added \r
      $part->print($out);
      $out->print("\r\n"); #Krishnan: add \r ### needed for next
      delim/close
      }

      $out->print("--$boundary--\r\n"); #Krishnan: add \r

      === end ===

      I *think* the MIME RFC requires CRLF - is there any particular
      reason why MIME::Entity does not do this?

      Regards.
      Krishnan
    • Byrne Reese
      This problem was fixed in SOAP::Lite 0.60. I would consult the MIME::Tools website regarding the use of r n in their code - it appears to be a little
      Message 2 of 2 , Oct 19, 2004
      • 0 Attachment
        This problem was fixed in SOAP::Lite 0.60.

        I would consult the MIME::Tools website regarding the use of "\r\n" in
        their code - it appears to be a little contraversial believe it or not,
        despite the spec being pretty clear. It all has to do with backwards
        compatibility I think. Pshaw. ;)

        Anyway, to work around this, Eriq was kind enough to add the following
        variable which can be set by anyone using MIME::Tools. The constant
        allows users to set the BOUNDARY_DELIMITTER. SOAP::Lite sets this for
        you to "\r\n" - but you can set it to anything you like.

        The following code shows someone how to set it. I use "local" to keep my
        changes to this variable "private."

        local $MIME::Entity::BOUNDARY_DELIMITER = "\r\n";


        krishnan_anantheswaran@... wrote:

        > Hi,
        >
        > I'm trying to send a multipart/related SOAP message with an
        > attachment to a webservice (implemented in Java using Apache Axis).
        >
        > (I know that this is not *officially* supported by SOAP::MIME but it
        > seems to be pretty close - read on).
        >
        > The server croaks in trying to parse the message.
        >
        > The reason, I found, was that the MIME::Entity uses "\n" as the
        > boundary delimiter and the Java code (Axis) expects "\r\n" as the
        > boundary delimiter.
        >
        > If I fix the print_body sub in MIME::Entity as so, this actually
        > works:
        >
        > === start ===
        >
        > foreach $part ($self->parts) {
        > $out->print("--$boundary\r\n"); #Krishnan:added \r
        > $part->print($out);
        > $out->print("\r\n"); #Krishnan: add \r ### needed for next
        > delim/close
        > }
        >
        > $out->print("--$boundary--\r\n"); #Krishnan: add \r
        >
        > === end ===
        >
        > I *think* the MIME RFC requires CRLF - is there any particular
        > reason why MIME::Entity does not do this?
        >
        > Regards.
        > Krishnan
        >
        >
        >
        >
        >
        > *Yahoo! Groups Sponsor*
        > ADVERTISEMENT
        > click here
        > <http://rd.yahoo.com/SIG=12cpqi06h/M=290828.4794622.5939935.1261774/D=egroupweb/S=1705701014:HM/EXP=1081452516/A=1950447/R=0/SIG=124ri7d3j/*http://ashnin.com/clk/muryutaitakenattogyo?YH=4794622&yhad=1950447>
        >
        >
        >
        > ------------------------------------------------------------------------
        > *Yahoo! Groups Links*
        >
        > * To visit your group on the web, go to:
        > http://groups.yahoo.com/group/soaplite/
        >
        > * To unsubscribe from this group, send an email to:
        > soaplite-unsubscribe@yahoogroups.com
        > <mailto:soaplite-unsubscribe@yahoogroups.com?subject=Unsubscribe>
        >
        > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
        > Service <http://docs.yahoo.com/info/terms/>.
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.