Cleo Cat
2005-06-23 00:44:25 UTC
Hi! I've been searching for a bit, so this post is a last resort :).
Would appreciate any help. I need to simply send an XML document to a
URL webpage servlet. The servlet however keeps returning failure saying
I'm missing an 'xml' parameter. here's the output I get:
<Envelope><Body><RESULT><SUCCESS>false</SUCCESS></RESULT><Fault><Request/><FaultCode/><FaultString>Missing
'xml'parameter</FaultString><detail><error><errorid>52</errorid><module/><class>SP.API</class><method/></error></detail></Fault></Body></Envelope>
here's the program I'm using (URL changed to protect internal company
information ;) ):
#!/usr/bin/perl
use strict;
use LWP::UserAgent;
use HTTP::Request;
my $ua = LWP::UserAgent->new;
my $req = new HTTP::Request POST =>
"http://some.website.com/servlet/XMLAPI";
my $content = qq{<?xml version="1.0" encoding="UTF-8"?>} .
"<Envelope><Body><AddRecipient>" .
"<LIST_ID>12345</LIST_ID><CREATED_FROM>1</CREATED_FROM>" .
"<COLUMN><NAME>EMAIL</NAME><VALUE>somebody\@domain.com</VALUE></COLUMN>" .
"<COLUMN><NAME>Fname</NAME><VALUE>John</VALUE></COLUMN>" .
"</AddRecipient></Body></Envelope>";
$req->content("$content");
print $req->content; #Debug
$req->content_type("text/xml; charset=utf-8");
my $response = $ua->request($req);
my $content = $response->content;
print "\nCONTENT\n-------\n$content\n-------\n";
---------------------
There you have it. I got the basic program from another web page that
says it worked for them, but when I try I get the missing 'xml'
parameter, and the techsupport people at the remote company don't know
what that means. I tried Encoding the $content at one point. maybe I did
that wrong?
Anyhow, any help would be very cool. I simply wanna send XML to a URL on
port 80 and get a response :). Nothing fancy needed. Would like to learn
how to talk to the servlet manually and not hide it behind a bunch of
modules until I know how it works at the lowest level (like telnetting
to a POP3 server to learn how it works, etc..)
Thanks!
Would appreciate any help. I need to simply send an XML document to a
URL webpage servlet. The servlet however keeps returning failure saying
I'm missing an 'xml' parameter. here's the output I get:
<Envelope><Body><RESULT><SUCCESS>false</SUCCESS></RESULT><Fault><Request/><FaultCode/><FaultString>Missing
'xml'parameter</FaultString><detail><error><errorid>52</errorid><module/><class>SP.API</class><method/></error></detail></Fault></Body></Envelope>
here's the program I'm using (URL changed to protect internal company
information ;) ):
#!/usr/bin/perl
use strict;
use LWP::UserAgent;
use HTTP::Request;
my $ua = LWP::UserAgent->new;
my $req = new HTTP::Request POST =>
"http://some.website.com/servlet/XMLAPI";
my $content = qq{<?xml version="1.0" encoding="UTF-8"?>} .
"<Envelope><Body><AddRecipient>" .
"<LIST_ID>12345</LIST_ID><CREATED_FROM>1</CREATED_FROM>" .
"<COLUMN><NAME>EMAIL</NAME><VALUE>somebody\@domain.com</VALUE></COLUMN>" .
"<COLUMN><NAME>Fname</NAME><VALUE>John</VALUE></COLUMN>" .
"</AddRecipient></Body></Envelope>";
$req->content("$content");
print $req->content; #Debug
$req->content_type("text/xml; charset=utf-8");
my $response = $ua->request($req);
my $content = $response->content;
print "\nCONTENT\n-------\n$content\n-------\n";
---------------------
There you have it. I got the basic program from another web page that
says it worked for them, but when I try I get the missing 'xml'
parameter, and the techsupport people at the remote company don't know
what that means. I tried Encoding the $content at one point. maybe I did
that wrong?
Anyhow, any help would be very cool. I simply wanna send XML to a URL on
port 80 and get a response :). Nothing fancy needed. Would like to learn
how to talk to the servlet manually and not hide it behind a bunch of
modules until I know how it works at the lowest level (like telnetting
to a POP3 server to learn how it works, etc..)
Thanks!