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

Re: [soaplite] Problem with binary file

Expand Messages
  • Duncan Cameron
    ... I am not sure that this is really doing what you want. I think that your file will be still returned as multiple lines but without any r n mangling. To
    Message 1 of 2 , Jun 20, 2004
    • 0 Attachment
      On 20-06-2004 at 11:25:38 leiandding <leiandding@...> wrote:

      >Hello all,
      > We are using EJB to provide a webservice which allows the Perl
      >client to upload and "download data, which is actually stored in a
      >temporary file on the server.
      > The web service provides two methods: testUpload for uploading file
      >and testDownload for downloading previously uploaded file.
      >
      >== Method Prototype in WSDL ==
      > testUpload(xsd:base64Binary content)
      > xsd:base64Binary testDownload()
      >
      > The testDownload method is just fine, but there are problems with
      >testUpload. No errors are reported in the process, but the server just
      > don't write the content into the file.
      > Really confused with this problem ... Any suggestions are welcome.
      > Thanks in advance!
      >
      > Here's the testUpload code:
      >
      > sub testUpload
      > {
      > print("Please enter the filename:");
      > $filename=<STDIN>;
      > chop($filename);
      > print("\n\n-------------\n\nUploading..............");
      > open(APPFILE,$filename) || die("Can not open the file");
      > binmode(APPFILE);
      > @content=<APPFILE>;
      I am not sure that this is really doing what you want. I think that your file will be still returned as multiple lines but without any \r\n mangling.
      To read all the content of a file into a variable
      {
      local $/ = undef;
      $content = <APPFILE>;
      }
      > # print(@content); it can print the content of the file.
      > close(APPFILE);
      > $session->testUpload(@content) || die("Can not Upload");

      You are passing several parameters to testUpload(), one for each line in your file, not just one.

      my $result = $session->testUpload(
      SOAP::Data->name(content => $content)->type('base64');
      print $result;

      You probably need to look at the logs on your server to see exactly what is being sent.

      Regards
      Duncan
    Your message has been successfully submitted and would be delivered to recipients shortly.