I'm new to Perl and apparently clueless on web work. I'm trying to do something that should be dramatically simple (IMO) but has tied me up for an entire day so it's past time to ask questions.
I need to use an HTTP get with a token to retrieve a key for further queries to a particular web site.
Get Request:
GET /MyDataService/MyDataService.asmx/Authenticate?CustomerToken=string HTTP/1.1 Host: services.hjknet.com
Get Response:
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <string xmlns="https://services.hjknet.com/MyDataService/">string</string>
What I'm doing right now is to following:
######################################################################
+## W
#!/usr/bin/perl -w
use strict;
use warnings 'all';
use LWP::Simple;
use XML::Simple;
my $url = 'http://services.hjknet.com/MyDataService/MyDataService.asmx
+/Authenticate?CustomerToken=+NotMyRealToken== HTTP/1.1';
my $xml = new XML::Simple;
my $xml_raw = get $url;
my $inc_data = ();
$inc_data = $xml->XMLin($xml_raw, SuppressEmpty => '' );
print "Inc_data: " . $inc_data . "\n";
print "Inc_data->{xmlns}: " . $inc_data->{xmlns} . "\n";
######################################################################
+##
When I run this I get back (obfuscated...):
Inc_data: HASH(0x1ff9b88)
Inc_data->{xmlns}: https://services.hjknet.com/MyDataService/
I should be getting back a string that represents our key for other services. Any help or suggestions would be greatly appreciated. Please don't hit me too hard if I'm missing something dumb. Clearly I'm new to both Perl and LWP...
Thanks!
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.