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

problem with soap attachments

Expand Messages
  • q3nx
    I am having a problem getting attachments to work. I have gone through all of the previous messages on this topic, however none of them solved my problem. I am
    Message 1 of 1 , Jul 13 1:14 PM
    • 0 Attachment
      I am having a problem getting attachments to work. I have gone through
      all of the previous messages on this topic, however none of them
      solved my problem.

      I am using Apache2::SOAP for mod_perl2 support after the mod_perl2 API
      changes.

      I am using this code to create the soap request (slightly modified to
      conceal paths):


      CLIENT CODE:

      my $Ent = MIME::Entity->build(
      Type => "image/jpeg",
      Encoding => 'base64',
      Path => "/path/to/tehimage.jpeg",
      Filename => "tehimage.jpeg",
      Disposition => 'attachment'
      );

      my @Parts = ($Ent);

      $Response = SOAP::Lite
      ->readable(1)
      ->uri("urn:/OR/SOAP")
      ->parts(@Parts)
      ->proxy("https://myserver.com/soap")
      ->req(FileName=>'tehimage.jpeg');


      httpd.conf:

      <Location /soap>
      SetHandler perl-script
      PerlResponseHandler Apache2::SOAP
      PerlSetVar dispatch_to "OR::SOAP"
      </Location>


      THE SOAP REQUEST:

      SOAP::Transport::HTTP::Client::send_receive: POST
      https://myserver.com/soap HTTP/1.1
      Accept: text/xml
      Accept: multipart/*
      Content-Length: 5293
      Content-Type: Multipart/Related; type="text/xml";
      start="<main_envelope>"; boundary="----------=_1121282892-23095-0";
      charset=utf-8
      SOAPAction: "urn:/OR/SOAP#req"

      This is a multi-part message in MIME format...

      ------------=_1121282892-23095-0
      Content-Type: text/xml
      Content-Disposition: inline
      Content-Transfer-Encoding: 8bit
      Content-Location: /main_envelope
      Content-ID: <main_envelope>

      <?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope
      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema"
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      >
      <SOAP-ENV:Body
      >
      <namesp6:req xmlns:namesp6="urn:/OR/SOAP"
      >
      <c-gensym28
      >
      <FileName xsi:type="xsd:string"
      >tehimage.jpeg</FileName></c-gensym28></namesp6:re
      q></SOAP-ENV:Body></SOAP-ENV:Envelope>
      ------------=_1121282892-23095-0
      Content-Type: image/jpeg; name="tehimage.jpeg"
      Content-Disposition: attachment; filename="tehimage.jpeg"
      Content-Transfer-Encoding: base64
      Content-Description: This is a SOAP request with an image as a MIME
      attachment.
      MIME-Version: 1.0
      X-Mailer: MIME-tools 5.417 (Entity 5.417)

      /9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAHgAA/+4ADkFk
      b2JlAGTAAAAAAf/bAIQAEAsLCwwLEAwMEBcPDQ8XGxQQEBQbHxcXFxcXHx4X
      GhoaGhceHiMlJyUjHi8vMzMvL0BAQEBAQEBAQEBAQEBAQAERDw8RExEVEhIV
      FBEUERQaFBYWFBomGhocGhomMCMeHh4eIzArLicnJy4rNTUwMDU1QEA/QEBA
      QEBAQEBAQEBA/8AAEQgAlgCWAwEiAAIRAQMRAf/EAI0AAQACAwEBAAAAAAAA
      --snip--


      THE RESPONSE:

      SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
      Connection: close
      Date: Wed, 13 Jul 2005 19:29:19 GMT
      Server: Apache
      Content-Length: 787
      Content-Type: text/xml; charset=utf-8
      Client-Date: Wed, 13 Jul 2005 19:29:19 GMT
      Client-Peer: [some ip]
      Client-Response-Num: 1
      SOAPServer: SOAP::Lite/Perl/0.60

      <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema"
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org
      /soap/encoding/"><SOAP-ENV:Body><SOAP-ENV:Fault><f
      aultcode>SOAP-ENV:Client</faultcode><faultstring>Application
      failed during request deserialization [Lite.pm]: junk 'This is a
      multi-part message in MIME format...

      ------------=_1121282959-23095-1
      Content-Type: text/xml
      Content-Disposition: inline
      Content-Transfer-Encoding: 8bit
      Content-Location: /main_envelope
      Content-ID: ' before XML element
      </faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>



      The above fault is happening before it ever gets to my service module.
      It seems to be dying in SOAP::Lite.pm inside of the decode sub on the
      line: my $parsed = $self->parser->parse($_[0]);

      Any ideas?
    Your message has been successfully submitted and would be delivered to recipients shortly.