kawazu has asked for the wisdom of the Perl Monks concerning the following question:

Hello all,... ...first of all, being new to here: Hello. I'm Kris. :) Being using perl for quite a lot of years now, I some days ago stepped into SOAP::Lite more or less out of necessity rather than "just" interest. Actually, I am about to create a "server" which processes data coming from an already existing client. Time for that is _rather_ short, and in the end I am left with learning about SOAP and (mostly) XML in less than two weeks. :/
Anyhow, thanks to "Programming Web Services In Perl" (great book, a really worthy buy), I by now at least have a slight idea of what is goin' on, and also wrote some small try-out SOAP client/server pairs for example to modify images using perlmagick - funny. :)<br Anyhow, as for my special task, there are two issues I don't yet know how to solve:

(a) As stated, the client which should connect to our server already exists. To write the server I was given some sample SOAP messages of what the client sends to the server, and which I need to process in order to put the data submitted somewhere. Question: Inside a SOAP::Transport::HTTP::CGI, how do I get the unmodified, full message that has been posted to that server? How can I access the XML code itself to extract what I need?

(b) Those messages will come with a .zip file attached which contains several files; and, as for the client, message and file can be transmitted using MIME and DIME. How do I access this file that is attached to the message (actually, the file name itself is, as a string, found in the xml part of that message).

Sorry if those questions are probably rather stupid or too obvious, perhaps I'll find out how to do this, myself, by movin' on reading through the documentation I found, but I'd really be thankful for some hints on that...
TIA, have a nice week anyone. :)
Kris

Replies are listed 'Best First'.
Re: SOAP::[MIME/Lite] and SwA...
by simon.proctor (Vicar) on Aug 12, 2003 at 10:37 UTC
    I'm not sure if this helps but in my system I have to transmit , receive and process the raw XML data within the Body of the SOAP packet:
    my $response = $service->transport->send_receive( envelope => $envelope );
    Where the $envelope is the XML I have created (This is the whole thing, envelope/head/body).

    I also have to deal with multiple attachments and had little luck getting SOAP::Attachments to work with the Sun Java libraries. I just used Mime::Parser and determined the content type, parts (etc)
    my $entity = $parser->parse_data($response);
    You can then do this:
    # We have some parts - one XML at least my $num_parts = $entity->parts; # No guarantee of order for(my $i = 0; $i < $num_parts; $i++) { my $part = $entity->parts($i); if($part->mime_type eq 'text/xml') { # Do stuff with XML } else { $datatype = $part->mime_type; # Do stuff with attachment } }
    I hasten to add I didn't like the fact I couldn't use a SOAP::* module but I had immense difficulty (at the time) getting SOAP::Lite and Sun to play together anyother way (this was a year ago btw).