| SOAP-MySOAP documentation | Contained in the SOAP-MySOAP distribution. |
SOAP::MySOAP - An extremely basic SOAP client module
Version 0.023
use SOAP::MySOAP;
my $client = SOAP::MySOAP->new("http://www.server.com/soap.jsp");
my $reply = $soap->request($rawxml);
print $reply;
Creates a SOAP::MySOAP object, a SOAP client that can issue SOAP requests to the $url URL.
Sends $rawxml to the SOAP server and returns the XML that it receives.
| SOAP-MySOAP documentation | Contained in the SOAP-MySOAP distribution. |
package SOAP::MySOAP; use warnings; use strict; use LWP 5.64;
our $VERSION = '0.023';
sub new { my $class = shift; my $endpoint = shift; my $params = shift || {}; my $ua = LWP::UserAgent->new; $ua->agent("MySOAP/0.1 "); my $self = { endpoint => $endpoint, ua => $ua, %$params, }; bless $self, $class; }
sub request { my $self = shift; my $xml = shift; my $req = HTTP::Request->new(POST => $self->{'endpoint'}); $req->header( SOAPAction => '""' ); $req->content_type('text/xml; charset=UTF-8'); $req->content($xml); $req->content_length(length($xml)); if ($self->{'debug'}) { print $req->as_string; } $self->{'request'} = $req; my $res = $self->{'ua'}->request($req); $self->{'response'} = $res; if ($self->{'debug'}) { print $res->as_string; } return $res->content; } 1;