Hello, I am very new to Perl and I want to create a Perl web service that accepts a SOAP message, grabs the XML as a text block and saves it in a DB. To do this I created two simple Perl stubs to send an XML doc to a very simple web service. However, I only get an error saying cannot access member in main. I looked this up and only seem to find very generic reasons of which none seem to apply. Below is the very simple code I have written. I am using Strawberry PERL via IIS. Code to send the SOAP message is below. I use a predefined string for the message as I want to swap out many different SOAP messages for testing.
My very simplistic server code is below. Again, eventually I want to grab the XML as text but cannot even get it to connect without the error right now. I have also made Demo a class and called it as such but that did not change the error. Any ideas would be appreciated.#!perl use HTTP::REQUEST; use LWP::UserAgent; #print "Hello there\n"; my $useragent = LWP::UserAgent->new(agent => 'Perl Post'); my $message = '<?xml version="1.0"?><soap:Envelope xmlns:soap="http:// +localhost"><soap:Header></soap:Header><soap:Body><soap:Method>Demo</s +oap:Method></soap:Body></soap:Envelope>'; my $response = $useragent->post('http://localhost/read_xml.pl',Content +_Type => 'text/xml', Content => $message); print $response->as_string; exit;
#!perl use SOAP::Lite; use SOAP::Transport::HTTP; #print "Content-type: text/plain\n\n"; SOAP::Transport::HTTP::CGI -> dispatch_to('Demo') -> handle; package Demo; print "Content-type: text/plain\n\n"; print "This is a test\n"; my $argument = pop; print "Argument is: $argument\n"; exit;
In reply to Web Service error by chuck882
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |