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

I'm using SOAP::Lite to create a server that will accept a text file, convert it to XML, and write the XML to a file on the system. Basically it should take everything but the SOAP envelope and write that data to an XML file in the file system. I know this isn't the usual usage of SOAP but is this even possible using a SOAP server and Perl?
  • Comment on Need help with converting a text file to XML

Replies are listed 'Best First'.
Re: Need help with converting a text file to XML
by samtregar (Abbot) on Jun 21, 2007 at 18:07 UTC
    You could play around with SOAP::Lite's debugging hooks to try to get access to raw XML text of the message. Alternately, you could pass the parsed data-structure to XML::Simple's XMLout() routine, which will give you the rough equivalent.

    -sam

      Thanks sam,
      I messed around with XMLout() before and did not get very far but after reading your post I thought I may revisit that method.
      So I came up with this that works for the time being. It just places the plain text attributes in <opt> </opt> tags but that is okay for now. Here is my client code that calls a soap server that implements two functions to convert temp between celcius and farenheit. #!/usr/bin/perl -w use SOAP::Lite; use XML::Simple; $xmlS = new XML::Simple; my $soap = SOAP::Lite -> uri('http://<fubared host>/Temperatures') -> proxy('http://<fubared host>/'); $xmlS = XMLout ($soap ->(37.5) -> result); print $xmlS; print "\n"; xmlS = XMLout ($soap -> f2c(99.5) -> result); print $xmlS; print "\n"; Then later I can work on the formatting of the xml file.