Fellow monks, I'm at a clients site so my ass is grass right this very moment if I can't get this going rather quickly. I've to the following code trying to post an XML document to an SSL site for parsing:
sub postXML { my $self = shift; my $finalXML = $self->getFinalXML(); my $POST_URL = $self->getProcessingURL(); # print $finalXML, "\n"; # use Net::SSLeay; # my ($page, $response, %reply_headers) = # Net::SSLeay::post_https( # 'secdev.sslsite.com', # 11800, # '', # Net::SSLeay::make_headers('Content-type' => 'application/ +x-www-form-urlencoded'), # Net::SSLeay::make_form(CLRCMRC_XML => "$finalXML") # ); # print 'Response: ', $response, "\n"; # print 'Page: ', $page, "\n"; use LWP::UserAgent; my $userAgentObject = LWP::UserAgent->new(); $userAgentObject->agent("ClearCommerce::XML::POST/0.1"); use HTTP::Request; my $postRequestObject = HTTP::Request->new(POST => $POST_URL); $postRequestObject->content_type('application/x-multipart-form-dat +a'); $postRequestObject->content("CLRCMRC_XML=$finalXML"); print 'Posting to ', $self->{processingURL}, " the following:\n"; print $finalXML, "\n"; my $postRequestResponseObject = $userAgentObject->request($postReq +uestObject); print $userAgentObject->request($postRequestObject)->content(); if ($postRequestResponseObject->is_success) { print $postRequestResponseObject->content(), "\n"; } else { print "Bad Request.\n"; } }
No running the commented out code (which actually works; the LWP code doesn't do anything but return my Bad Request print) gives me back a response form the server saying that the XML was not included or was formattted badly. Now I know that it's formatted correctly from printing the $finalXML variable. Do I need to escape the XML somehow or something? I'm totally at a loss for what to do at this point. I was up all night trying to get this working. Any help that anyone could contribute would be wonderful and greatly appreciated. D.

dpatrick
- I think scsh is cool.
Open Sourceror, Perlmonk
http://perlmonk.org/~dpatrick

In reply to Can't Post XML to SSL Site by dpatrick

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.