Trying to connect my app to USPS and their Rate API to return running rates on packages. To test on their server, I have a dummy XML I’m passing to see if I can get any response, but Corona is saying that the URL I’m passing is malformed. Anyone have any thoughts?
[lua]
local path = system.pathForFile( “req_usps.xml”, system.ResourceDirectory )
local request = io.open( path, “r” )
local postData = request:read( “*a” )
local function networkListener( event )
if ( event.isError ) then
print( “Network error!”)
else
print ( "RESPONSE: " … event.response )
end
end
local target = “http://production.shippingapis.com/ShippingAPI.dll?API=RateV4&XML=” … postData
print( target )
network.request( target, “GET”, networkListener )
[/lua]
And the error…
2013-03-14 11:36:09.906 Corona Simulator[16116:707] http://production.shippingapis.com/ShippingAPI.dll?API=RateV4&XML=<?xml version="1.0" encoding="UTF-8" ?>2FIRST CLASSPARCEL2290333101260REGULARtrue
2013-03-14 11:36:09.906 Corona Simulator[16116:707] Invalid Parameter: URL argument was malformed URL
Warning: /Users/kmusngi/Development/USPS_req_test/main.lua:23: URL argument was malformed URL