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

Re: Multiple attachments (was: Newbie soaplite/axis question)

Expand Messages
  • gregs4321 <gregs4321@yahoo.com>
    Thanks for the fast reply! Thought I sent this last night but didn t see it on the list this AM, so if both replies suddenly appear or if the first one went
    Message 1 of 3 , Mar 1, 2003
    • 0 Attachment
      Thanks for the fast reply!

      Thought I sent this last night but didn't see it on the list this
      AM, so if both replies suddenly appear or if the first one went astray
      --- I apologize..

      Last night after reading the reply I took out the while loop and
      constructed the entities as the example code shows. I still got the
      same message so I thought I'd move the script to a different platform
      and see what happened.

      I was writing and testing on a FreeBSD workstation using Perl 5.6.1
      and moved the script with its dependencies to a Solaris server running
      Perl 5.005_03. It behaved differently in that it didn't croak and
      received a response from the server service as if there were no
      attachments. No soap fault was generated.

      I ran it again with Axis TCPMon and SOAPLite trace turned on and
      neither show attachments on the wire. For a sanity check I ran it
      again on the FreeBSD platform and it still sends a single attachment
      but croaks on multiples.

      I am hoping that something really stands out here that I just don't
      see....

      -Greg

      --- In soaplite@yahoogroups.com, Byrne Reese <breese@g...> wrote:
      > Ok, I am looking into this, but I wanted to reply quickly so that
      you
      > knew that someone was listening. ;)
      >
      > As it turns out - I wrote a little script myself to try send
      multiple
      > attachments to an Axis service... unfortunately, not many services
      > actually use attachments (oh, the irony)... Here is the script I
      wrote
      > which works fine:
      >
      > (Note: The service I am invoking on the other end is real, but it
      gives
      > a 500 Server Error... all I am trying to see is if SOAP::Lite and
      > SOAP::MIME croak on when multiple attachments are used. SOAP::Lite
      did
      > not die when I sent the message...)
      >
      > ################################################
      #######################
      > #!/usr/bin/perl
      >
      > use SOAP::Lite +trace => qw(debug);
      > use SOAP::MIME;
      > use MIME::Entity;
      >
      > my $ent1 = build MIME::Entity
      > Type => "image/png",
      > Encoding => "base64",
      > Path => "attachments/reg-step1sm.png",
      > Filename => "reg_step1sm.png",
      > Disposition => "attachment";
      >
      > my $ent2 = build MIME::Entity
      > Type => "text/xml",
      > Path => "attachments/some.xml",
      > Filename => "some.xml",
      > Disposition => "attachment";
      >
      > push @attachments, $ent1;
      > push @attachments, $ent2;
      >
      > my $som = SOAP::Lite
      > ->readable(1)
      > ->uri('http://webservices.imacination.com/distance/Distance.jws')
      > # ->parts([ $ent ])
      > ->parts(@attachments)
      > ->proxy('http://webservices.imacination.com/di
      stance/Distance.jws')
      > ->getDistance(
      > SOAP::Data->name('fromZip' => 94610)->type('string'),
      > SOAP::Data->name('toZip' => 94105)->type('string')
      > );
      >
      >
      > On Fri, 2003-02-28 at 14:51, gregs4321 wrote:
      > > Hi,
      > >
      > > I am new to webservices and am trying to send multiple attachments
      > > from a soap::lite client to an axis server. I had to make the
      > > changes recommended from a post found here by msanesh ( added
      '/r' to
      > > the same two lines in Entity.pm ) and am now able to send a
      message
      > > with a single attachment.
      > >
      > > My problem is that I can't send more than one attachment. If I
      do I
      > > get the following message: SOAP error: Can't call method "print"
      on an
      > > undefined value at ..../perl/lib/MIME/Entity.pm line 1803.
      > >
      > > Here is what I tried:
      > > .......
      > > .......
      > > .......
      > > while ( @ARGV ) {
      > > my $filepath = shift @ARGV;
      > > my MIME::Type $mime = $types->mimeTypeOf( $filepath );
      > > ( my $filename = $filepath) =~ s!^.*/!!;
      > > my $cid = "Report";
      > > $ent = build MIME::Entity
      > > Type => $mime,
      > > Encoding => "base64",
      > > Path => $filepath,
      > > Filename => $filename,
      > > 'Content-Id' => "<$cid>",
      > > Disposition => "attachment";
      > > push @parts, $ent;
      > > }
      > > $webcall::som = SOAP::Lite
      > > ->uri( $uri )
      > > ->proxy( $endpoint )
      > > ->parts( @parts ); ## substitute $ent and
      > > ## it will send the
      last
      > > ## ARG file
      succesfully!
      > > .....
      > > .....
      > > .....
      > >
      > > eval {
      > > $result = $webcall::som->addMcorrMulti(
      $accode,$refNum,$msgNum,
      > > $report) };
      > >
      > > warn "SOAP error: $@" if $@; ## here is where the error is
      caught
      > > .....
      > > .....
      > >
      > > I originally had a different $cid for each iteration of the
      'while'
      > > and had the same problem. What am I missing??
      > >
      > > Thanks,
      > > Greg
      > >
      > >
      > > Yahoo! Groups Sponsor
      > > ADVERTISEMENT
      > >
      > >
      > > To unsubscribe from this group, send an email to:
      > > soaplite-unsubscribe@yahoogroups.com
      > >
      > >
      > >
      > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
      Service.
    Your message has been successfully submitted and would be delivered to recipients shortly.