Hello - I'm trying to post XML via HTTP POST and am getting back from the server: "Missing parameter: labelRequestXML." The transport works-- I can use the commands minus the xml code to communicate successfully with the server. Indeed, since I get the error response, I know I'm communicating with the server. I have validated the xml part with their server (using their own HTTP POST test tool). So, I'm thinking that somehow I'm not properly formatting or submitting the xml code part, as they're getting the request and responding- just not recognizing the xml code for what it is. I've tried many (many) variations. I'm stuck. Any help would be most appreciated! Thanks - Josh
Code is as follows:
#!/usr/bin/perl use strict; use warnings; use LWP 5.64; my $browser = LWP::UserAgent->new; my $xml= qq[<?xml version="1.0" encoding="utf-8" ?> <LabelRequest Test="YES" LabelType="Default" LabelSize="4X6" ImageForm +at="PNG"> <RequesterID>xxxxxx</RequesterID> <AccountID>xxxxxx</AccountID> <PassPhrase>xxxxxx</PassPhrase> <MailClass>First</MailClass> <DateAdvance>0</DateAdvance> <WeightOz>15</WeightOz> <MailpieceShape>Parcel</MailpieceShape> <Stealth>FALSE</Stealth> <Services InsuredMail="OFF" SignatureConfirmation="OFF" /> <BarcodeFormat>CONCATENATED</BarcodeFormat> <Value>0</Value> <Description>Sample Label</Description> <PartnerCustomerID>12345ABCD</PartnerCustomerID> <PartnerTransactionID>6789EFGH</PartnerTransactionID> <ToName>Amine Khechfe</ToName> <ToCompany>PSI Systems, Inc.</ToCompany> <ToAddress1>247 High Street</ToAddress1> <ToCity>Palo Alto</ToCity> <ToState>CA</ToState> <ToPostalCode>84301</ToPostalCode> <ToZIP4>0000</ToZIP4> <ToDeliveryPoint>00</ToDeliveryPoint> <ToPhone>8005763279</ToPhone> <FromName>John Doe</FromName> <ReturnAddress1>123 Main Street</ReturnAddress1> <FromCity>Boise</FromCity> <FromState>ID</FromState> <FromPostalCode>83702</FromPostalCode> <FromZIP4>7261</FromZIP4> <FromPhone>8005551212</FromPhone> </LabelRequest>]; my $url = 'https://www.envmgr.com/LabelService/EwsLabelService.asmx/Ge +tPostageLabelXML'; my $response = $browser->post( $url, $xml ); print $response->content;

In reply to Post XML by joshuahess

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.