soap::lite passing xml data to perl script.

Hi, I am writing a soap::lite client to send/receive xml request to a .net web service.
problem is the xml request is getting very complicated and deep. Its there a way to import a pre made xml file to the perl script and have the script create the body of the request from the xml file?
Thanks rob.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi !

I'm not sure what you want do.

Maybe with the module : XML::Parser

Best Regards
robidsAuthor Commented:
Hi.  I need to send/receive xml request to a .net web service using soap:lite
below is the xml file that i need to send via soap::lite to the .net web sevice.






<TrackData method="swiped">
B4012002000060016 VI TEST CREDIT251210118039000000000396




how do i pass this xml file to the perl script???
> how do i pass this xml file to the perl script???
no, you perl script reads the file content and passes it as HTTP message body to the corresponding URL
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

robidsAuthor Commented:
OK, Thats my question. How is this done?. I need to pass the data to the script so the data can be sent via the soap::lite mxl request to the .net webserver.
as long as you do not provide the code you have done so far it's difficult to give you proper samples. Probably following helps you:
   if (open(X,";
     SOAP::Data->name("yourdata" => $xml);
    # .. your other code
robidsAuthor Commented:
Thank you here is my code.
###my $WSDL="";
my $NS = "";
my $HOST = "";
use strict;
use SOAP::Lite +trace => qw (debug);
my $search = SOAP::Lite
->on_action( sub { return '""';} )
my $method =  ### pull in xml file ###
my $results = $search->call($method  );
print $results;

Open in new window

Use this for your line 16
my $method;
open(my $in, "<your_xml_file.xml") or die "Could not open xml: $!\n";
{local $/;

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
robidsAuthor Commented:
wow that's it except the output request is turned into the following:

<Amt>25</Amt> &#xd;
instead of

can the be formatted?
The above will read the your_xml_file.xml into $method.  No modification is done - the file is read exactly as it is.

I'm not sure what you want to do.... but to remove "&#xd;" you could use this:
    $var =~ s/&#xd;//;
Replace $var with whatever variable has the data.
robidsAuthor Commented:
Thank You.
 The problem is with what the soap::lite does to the imported xml data. The soap envenlope gets changed to <Amt>25</Amt> &#xd; in stead of what is pass to the scrip 25 on the output.  I need to get the output formatted correctly. Thanks again for your help
hmm, what is the big difference between my suggestion and the graded one, may be I'm too blind for that ...
Yes, they are very similar.  I would be okay with a split.
Adam314, my wondering was meant for the questioner ;-)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.