modperl-sending_xml_data_over_http

This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.



Date: Wed, 18 Oct 2000 12:19:07 -0400 (EDT)
From: cloudnine <cloudnine@escapement.net>
To: modperl@apache.org
Subject: Re: XML help (offtopic)?

On Tue, 17 Oct 2000, Geoffrey Gallaway wrote:
> 
> I'm trying to find a way to do XML over HTTP. I have a project at work
> that I'm doing where we have a XML based system. The system would connect
> to port 80 and do XML over HTTP. I'm not exactly sure what this entails
> but I'm guessing using the HTTP protocall to send XML. So, you get the
> HTTP methods (GET, POST, HEAD, etc) and headers (Date, Server,
> Content-Type, etc) but with XML data instead of HTML. Now, I understand I
> could easily use apache to send XML data (GET) but I'm not to sure how I
> should handle receiving XML (POST). I definetly want to do the XML parsing
> and such with perl (I've been playing with XML::Parser, very cool). What
> am I missing?

HTTP::Request is your friend.  It generates an HTTP request, whether it be
a get or a post. 
 
LWP::UserAgent actually performs the request for you.  

## example:
my $request = HTTP::Request->new(POST=>'http://foo.bar.com');
$request->content_type('application/x-www-form-urlencoded');
$request->content("XMLStuff=$scalarWithYourXML"); ## add the xml to the post.

my $ua = LWP::UserAgent->new;
my $response;
$response = $ua->simple_request($request);
unless ( $response->is_success ) {
    ## do what must be done in event of a failure
}

## whatever else....

The receiving server could grab the XMLStuff as $r->param('XMLStuff');
Hope i answered your question!

- Matt Avitable


===

Date: Wed, 18 Oct 2000 00:33:02 -0400 (EDT)
From: Geoffrey Gallaway <geoffeg@sloth.org>
To: cloudnine <cloudnine@escapement.net>
Subject: Re: XML help (offtopic)?

I think I might have been a slight bit confusing in the email. I need to
have apache be able to *recieve* the POST and GET requests. I know how to
send the XML to another server, I just need to know how to get *my*
server to handle the requests/data from other clients..

===
Date: Tue, 17 Oct 2000 22:35:34 -0700
From: Perrin Harkins <perrin@primenet.com>
To: Geoffrey Gallaway <geoffeg@sloth.org>
Subject: Re: XML help (offtopic)?

Geoffrey Gallaway wrote:
> 
> I think I might have been a slight bit confusing in the email. I need to
> have apache be able to *recieve* the POST and GET requests. I know how to
> send the XML to another server, I just need to know how to get *my*
> server to handle the requests/data from other clients..

Seems like you'd handle this the same as any HTML form with a POST
method.  If you aren't sure what that looks like you can read the HTTP
specs or make LWP generate some POST requests and look at them.  It's
pretty simple stuff.

- Perrin

===
Date: Wed, 18 Oct 2000 16:37:04 -0400
From: Adi <adi@certsite.com>
To: Geoffrey Gallaway <geoffeg@sloth.org>
Subject: Re: XML help (offtopic)?

Have you looked at SOAP::Lite and the rest of the SOAP:: hierarchy on CPAN? 
They may not be of direct help if you've already got a home-grown XML transport
protocol, but it might give you some good ideas.  And, it may save you lots of
time in the long run if you can convert your home-grown XML system to use the
SOAP standard.

BTW, has anyone played with these SOAP modules much?  Specifically, are they
well-written / optimized for mod_perl?

===
Date: Wed, 18 Oct 2000 21:29:44 +0100 (BST)
From: Matt Sergeant <matt@sergeant.org>
To: Adi <adi@certsite.com>
Subject: Re: XML help (offtopic)?

On Wed, 18 Oct 2000, Adi wrote:

> Have you looked at SOAP::Lite and the rest of the SOAP:: hierarchy on CPAN? 
> They may not be of direct help if you've already got a home-grown XML transport
> protocol, but it might give you some good ideas.  And, it may save you lots of
> time in the long run if you can convert your home-grown XML system to use the
> SOAP standard.
> 
> BTW, has anyone played with these SOAP modules much?  Specifically, are they
> well-written / optimized for mod_perl?

I've played a little bit with SOAP::Lite. Its a great concept, and just
seemed to work, except in certain cases, for example you can't pass a DBI
handle over SOAP, obviously, and the same goes for globs and
filehandles. But other than that its almost transparent!

===

the rest of The Pile (a partial mailing list archive)

doom@kzsu.stanford.edu