[Israel.pm] SOAP in perl

ik idokan at gmail.com
Mon Jul 28 07:12:51 PDT 2008


Hello,

I'm trying  to send a soap xml to a .net soap server using perl (why
does .net have to use SOAP for such simple update ?! errr).

I found SOAP::Lite to be over complicated to my understanding, so I
tried to use LWP instead.
an example for what I'm doing is as follows:

sub send_content
{
  my $content = shift or return 0;
  my $ua = LWP::UserAgent->new;
  $ua->agent("WashingSOAP/0.1");

  # Create a request
  my $req = HTTP::Request->new(POST => 'http://...../');
  $req->header('SOAPAction' => '"http://tempuri.org/Save"');
  $req->content_type('application/soap+xml; charset=utf-8');
  #$req->content_type('text/xml; charset=utf-8');
  $req->content($content);

  # Pass request to the user agent and get a response back
  my $res = $ua->request($req);

  # Check the outcome of the response
  if ($res->is_success)
  {
    return $res->content;
  }
  else
  {
    return 0;
  }
}

I'm always having 500 error, and I wonder if anyone knows what am I
missing (the XML I'm sending seems to be valid according to the .net
people).

Thanks,
Ido
-- 
http://ik.homelinux.org/



More information about the Perl mailing list