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

3031Dime Attachements

Expand Messages
  • sseier
    Sep 30, 2003
    • 0 Attachment
      I've recently created a web service in .NET that replies with an
      embedded JPG file (Dime Attachment). I can call other methods in this
      web service properly via Perl and SOAP::Lite. However, when I call
      the service that replies with the embedded file I get the contents of
      the binary file scrolled across the window.

      I want to be able to save this file to my local directory on the
      computer that I run this with. Here's a sample of the server code:

      [WebMethod(Description="Using DIME attachments")]
      public void GetImageDIME()
      {
      SoapContext soap = HttpSoapContext.ResponseContext;
      string filepath = ImageDirectory ;
      DimeAttachment dimeImage = new DimeAttachment("image/jpg",
      TypeFormatEnum.MediaType, ImageDirectory);
      HttpSoapContext.ResponseContext.Attachments.Add(dimeImage);
      }

      and the client code:

      use SOAP::Lite ;

      my $soap = SOAP::Lite
      -> uri('http://myserver/WS4/')
      -> on_action( sub { join '/', 'http://myserver/WS4', $_[1] } )
      -> proxy('http://myserver/WS4/Service1.asmx');
      print $soap->GetImageDIME()->result;

      When I run this script I get the following error: Unexpected Content-
      Type 'application/dime' returned.

      I want to be able to save this file as in:

      my $result = $soap->GetImageDIME();
      open(FL, ">> sample.jpg") || die "Failure";
      write (FL, $result->result);
      close(FL);

      Any thoughts?
    • Show all 2 messages in this topic