Discussion:
missing 'xml' parameter sending XML to a URL
Cleo Cat
2005-06-23 00:44:25 UTC
Permalink
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!
Robert Barta
2005-06-26 07:31:53 UTC
Permalink
Post by Cleo Cat
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
<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
That's the cool thing about proprietary interfaces...
Post by Cleo Cat
my $req = new HTTP::Request POST =>
"http://some.website.com/servlet/XMLAPI";
Maybe these guys want you to send the XML as value for a parameter
'xml' in a GET request? Just guessing in the absence of ANY
server-side information.

\rho
Cleo Cat
2005-06-27 19:42:58 UTC
Permalink
Post by Robert Barta
Post by Cleo Cat
my $req = new HTTP::Request POST =>
"http://some.website.com/servlet/XMLAPI";
Maybe these guys want you to send the XML as value for a parameter
'xml' in a GET request? Just guessing in the absence of ANY
server-side information.
\rho
Ah, I got it! stupid... I just had to change it to a GET and append "xml=$xml_content" to the URL. Hmpf. Wonder why post wouldn't work... either way, GET seems to do the trick, thanks for the wording in your reply, it seems to trigger some different pathways in my brain to figure out the obvious solution, hehe...



[------------------------------------------------------]
Andrew Dubry SeƱior Web Programmer/Cat Petter
Office: 541.774.5475 http://www.musiciansfriend.com
Roving: 541.941.1659 Public Meow ID: 1024D/0A6A1F2Z

Loading...