This is what I was iplementing previously by using the LWP::UserAgent. 1. Firstly I was getting the error as : LWP::UserAgent::_need_proxy: Not proxied I could not get which value should I put variable ENV{HTTP_PROXY}, I did try for my network's proxy address with port 8080 as well as with 443(I was not sure for this) but I could not fix the problem. 2 Secondly I could not create the required headers with this method. As I need to pass 'POST /AUTHORIZE HTTP/1.1'(not in key value form but simple text) this text with the header when Unless I send complete header info their server will not respond. So I tried to have specific implemetation for SSL that is the reason I used NET::SSLeay. Here is the code I was using.
use strict; use Data::Dumper; use LWP::UserAgent; use HTTP::Request; use HTTP::Headers; use LWP::Debug qw(+); my $method = 'POST'; my $host = 'orbital1.paymentech.net'; my $uri = '/authorize'; $uri = 'https://orbital1.paymentech.net/authorize'; ## This is the fake request we are generating my $xmlRequest = '<?xml version="1.0" encoding="UTF-8"?>'. '<Request>'. '<NewOrder>'. '<IndustryType>EC</IndustryType>'. '<MessageType>A</MessageType>'. '<BIN>000002</BIN>'. '<TerminalID>001</TerminalID>'. '<AccountNum>4111111111111111</AccountNum>'. '<Exp>102009</Exp>'. '<CurrencyCode>840</CurrencyCode>'. '<CurrencyExponent>2</CurrencyExponent>'. '<CardSecVal>213</CardSecVal>'. '<AVSzip>33408</AVSzip>'. '<AVSaddress1>test address</AVSaddress1>'. '<AVScity>miami</AVScity>'. '<AVSstate>Florida</AVSstate>'. '<AVSphoneNum>5618926384</AVSphoneNum>'. '<AVSname>Raj Malahotra</AVSname>'. '<AVScountryCode>US</AVScountryCode>'. '<AVSDestzip>33408</AVSDestzip>'. '<AVSDestaddress1>Dest addresss</AVSDestaddres +s1>'. '<AVSDestcity>testcity</AVSDestcity>'. '<AVSDeststate>Florida</AVSDeststate>'. '<AVSDestname>Raj Malahotra</AVSDestname>'. '<AVSDestcountryCode>US</AVSDestcountryCode>'. '<CustomerProfileFromOrderInd>A</CustomerProfi +leFromOrderInd>'. '<OrderID>091933208935</OrderID>'. '<Amount>15.00</Amount>'. '<BMLShippingCost>15.00</BMLShippingCost>'. + '<BMLTNCVersion>5</BMLTNCVersion>'. + '</NewOrder>'. '</Request>'; my $MIME_Version = '1.1'; my $content_type = 'application/PTI42'; my $content_length = length($xmlRequest); my $content_transfer_encoding = 'text'; my $request_number = '1'; my $document_type = 'Request'; my $header = HTTP::Headers->new; $header->header ( 'MIME-Version' => $MIME_Version, 'Content-Type' => $content_type, 'Content-length' => $content_length, + 'Content-transfer-encoding' => $content_transfer_encodi +ng, 'Request-number' => $request_number, 'Document-type' => $document_type, + ); my $fix_headres = 'POST /AUTHORIZE HTTP/1.1' . "\r\n" . $header; my $HTTP_req = HTTP::Request->new($method,$uri,$header,$xmlRequest) ; my $UserAgent = LWP::UserAgent->new(); #$UserAgent->env_proxy; my $host_response = $UserAgent->request($HTTP_req); #print STDERR "\n========= headers ======== \n" . Dumper($header) +; #print STDERR "\n========= request ======== \n" . Dumper($HTTP_re +q); #print STDERR "\n========= response ======== \n" . Dumper($host_r +esponse); __END__
When I use the variable $fix_headres(which is created externally with the required headers) in the HTTP::Request->new($method,$uri,$fix_headres,$xmlRequest) it gives error of bad headers. Please suggest on this issue where should I concentrate. Thanks... SHAM.

In reply to Re^4: What can be the reasons for bad request ?? by Sham
in thread What can be the reasons for bad request ?? by Sham

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.