Having problem reading POSTed content.... Am trying to write handler which will
pass content onto MQ. Currently, I have the content as text\plain and not
url-encoded.
Here's my POSTing snippet...

#! /usr/bin/perl -w

use LWP::UserAgent;
use HTTP::Request;

$ua = LWP::UserAgent->new();
$ua->agent("$0/1.0");
$url = "http://tssdatadev.jc.jefco.com/wilco/PutXml/asynch";

$req = new HTTP::Request 'POST',$url;

$req->content_type('text/plain');
#$req->content_type('multipart/form-data');

$req->content_length(33);
$req->content("easter bunny is coming to town...");
$resp = $ua->request($req);
print $resp->as_string;

######################################################

Here's a snippet of the handler. I'm using read() to get the content... I
receive the content-length with no problem, but am unable to read the content.



package WILCO::PutXml;

#use strict "refs";

use Apache::Constants qw(:common);
use Apache::Registry;
use MQSeries;
use CGI;
use Carp;

do 'Constants.pl';
use lib '/apps/lib/perl';
require 'jefco.pm';

sub handler {

  my $r = shift;


# Parse out how I'm being called
  my($method);
  ($method=$r->uri)=~s!^.*/wilco/PutXml/(\w+)!$1!;
  $method =~ s/\?.*//;

# Get my arguments
#  my($http) = new CGI( $r->args || $r->content );
#  my %params = ($r->content, $r->args);


# Autoflush the output buffer
  $| = 1;
  open(XML,">/tmp/xml.log") || die "Cannot create log file: $!\n";


  $r->content_type('text/html');
  $r->header_out('pragma','no-cache');
  $r->send_http_header;


  $r->warn ("<!-- --------------------------- -->\n");
  $r->warn ("<!-- START PROGRAM - PutXml -->\n");
  $r->warn  ("<!-- Method = $method       -->\n");

############################################################################
# setup defaults, and envionment vairiables
############################################################################

  $ENV{MQSERVER} = $MQSERVER;

  my $PutQ = 'QL.WILCO.IN';
  my $GetQ1 = 'QL.WILCO.SYNC.OUT';
  my $GetQ2 = 'QL.WILCO.ASYNC.OUT';

  my $Msg;
  $r->read($Msg, $r->header_in('Content-length'));

  $r->warn ("<!-- ------------------------- -->");
  $r->warn ("<!-- ENVIRONMENT VARIABLES : -->");
  $r->warn ("<!-- mqserver     = $MQSERVER -->");
  $r->warn ("<!-- Queue Manager= $QM -->");
  if (!($Msg)){$r->warn ("<!-- Msg = $Msg -->");}

I get nothing in $Msg... What am I missing here???

Thanks in advance!



--------------------------------------------------------------
Jefferies archives and reviews outgoing and incoming e-mail.  Such may be 
produced at the request of regulators. Sender accepts no liability for 
any errors or omissions arising as a result of  transmission. Use by other than 
intended recipients is prohibited. This is neither an offer nor a 
solicitation of an offer to buy or sell securities. Opinions or estimates 
constitute our best judgment at this time and are subject to change without 
notice. Information upon which this material is based was obtained from 
sources believed to be reliable but has not been verified. Additional 
information is available upon request. Jefferies its affiliates and 
respective directors officers and employees may buy or sell 
securities mentioned as agent or principal. This is for use by 
professional or institutional investors only. No investments or 
services mentioned or described are available to "private 
customers" as defined by the SFA or to anyone in Canada not a "Designated 
Institution". 

Reply via email to