Hi,

I am trying to make an api call with xml however every time i make the call i get an error. The only workaround i could come up with was to

1) save the xml request to a text file.

2) Load the $request back in and assign to a $ string

3) then make the call.

Can anyone tell me a reason why this is happening and a method to make the call without first saving/loading the file?

# define the XML request (REVISE) if ($econfig =~ /ReviseInventoryStatusRequest/ ) { $req1 = "<?xml version='1.0' encoding='utf-8'?>" . "<ReviseInventoryStatusRequest xmlns=\"urn:ebay:apis:eBLBaseComponents +\">" . "<RequesterCredentials>". "<eBayAuthToken>$token</eBayAuthToken>". "</RequesterCredentials>". "<ErrorLanguage>en_US</ErrorLanguage>". "<WarningLevel>High</WarningLevel>". "<InventoryStatus>". "<ItemID>$uuid</ItemID>". "<StartPrice>$myprice1</StartPrice>". # "<Quantity>4</Quantity>" . "</InventoryStatus>". "</ReviseInventoryStatusRequest>"; } # POST VIA SINGLE CALL API if ($apipost == 1) {$apipost = 0 ; # WRITE THE XML REQUEST TO FILE open (UPCWRITE, '>apirequest1.txt');print UPCWRITE "$req1 stop\n";clos +e(UPCWRITE); # LOAD THE XML REQUEST BACK IN print "WOOT";print "$req1";open(F,'apirequest1.txt');@req1=<F>;close F +;$request ="@req1"; # make the call my $objRequest = HTTP::Request->new( "POST", "https://api.ebay.com/ws/api.dll", $objHeader, $request ); # deal with the response my $objUserAgent = LWP::UserAgent->new; my $objResponse = $objUserAgent->request($objRequest); if (!$objResponse->is_error) { print $objResponse->content;} else {pri +nt $objResponse->error_as_HTML;} } # if ($apipost == 1)

In reply to Formatted XML is not formatted: by Monkomatic

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.