J-vibe
04-01-06, 06:37 AM
Hi,
I'm looking everywhere for answers or direction to solving this.
There are no examples anywhere of how to do this is Miva.
I am trying to use the rate calculator API for a non-merchant
app. The USPS API wants XML scipt to be sent to it. I've basically
generated the script they want using Miva. When I MvCall it, I get a
"Parameter is incorrect" message. If I paste the "action" link to the
IE address bar, it works ! ?. Makes no difference with get/post. It
seems to me that MvCall is adding or changing something. I've even tried safe URL encoding methods and it still fails. BUT, like I said...If I take
the so-called failed link and paste it from MVCall directly to the address bar....It Works..!?? MvCALL must adding something to the submission.
Has anyone
successfully interacted with this or any of the APIs of the USPS? I
removed my ID code in this sample.
Here is the most basic call made from my server:
<MvAssign name="cstring"
value="{'http://testing.shippingapis.com/ShippingAPITest.dll?API=RateV2&XML=<RateV2Request
USERID=' $ asciichar(34) $ 'xxxx' $ asciichar(34) $ '><Package ID=' $
asciichar(34) $ '0' $ asciichar(34) $
'><Service>PRIORITY</Service><ZipOrigination>10022</ZipOrigination><ZipDest**ination>20008</ZipDestination><Pounds>10</Pounds><Ounces>5</Ounces><Contai*n*er>Flat
Rate Box</Container><Size>REGULAR</Size></Package></RateV2Request>'}">
<MvCall
action="{cstring}"
method="post">
<MvEVAL EXPR="{callvalue}">
</MvCall>
The response from the the USPS server is the following html page source
that states there is a parameter error. But, If I paste the http link
below in the address bar, it works just fine and the USPS returns the
correct response.
<html>
http://testing.shippingapis.com/ShippingAPITest.dll?API=RateV2&XML=<RateV2Request
USERID="xxxx"><Package
ID="0"><Service>PRIORITY</Service><ZipOrigination>10022</ZipOrigination><Zi**pDestination>20008</ZipDestination><Pounds>10</Pounds><Ounces>5</Ounces><C*o*ntainer>Flat
Rate
Box</Container><Size>REGULAR</Size></Package></RateV2Request><br><br>
<html>
<head>
<title>
Error
</title>
</head>
<body>
The parameter is incorrect.
</body>
</html>
</html>
Here is the the correct reponse from the USPS server after pasting the translated cstring contents directly to the address bar, but fails with MvCall.
<?xml version="1.0" ?>
- <RateV2Response>
- <Package ID="0">
<ZipOrigination>10022</ZipOrigination>
<ZipDestination>20008</ZipDestination>
<Pounds>10</Pounds>
<Ounces>5</Ounces>
<Container>Flat Rate Box</Container>
<Size>REGULAR</Size>
<Zone>3</Zone>
- <Postage>
<MailService>Priority Mail Flat Rate Box (11.25" x 8.75" x
6")</MailService>
<Rate>7.70</Rate>
</Postage>
- <Postage>
<MailService>Priority Mail Flat Rate Box (14" x 12" x
3.5")</MailService>
<Rate>7.70</Rate>
</Postage>
</Package>
</RateV2Response>
Am I overlooking something in the way I'm calling it from Miva?
I really don't want to switch to another language like PHP to do this request, but I'm starting to feel I have to.
Thanks in advance.
I'm looking everywhere for answers or direction to solving this.
There are no examples anywhere of how to do this is Miva.
I am trying to use the rate calculator API for a non-merchant
app. The USPS API wants XML scipt to be sent to it. I've basically
generated the script they want using Miva. When I MvCall it, I get a
"Parameter is incorrect" message. If I paste the "action" link to the
IE address bar, it works ! ?. Makes no difference with get/post. It
seems to me that MvCall is adding or changing something. I've even tried safe URL encoding methods and it still fails. BUT, like I said...If I take
the so-called failed link and paste it from MVCall directly to the address bar....It Works..!?? MvCALL must adding something to the submission.
Has anyone
successfully interacted with this or any of the APIs of the USPS? I
removed my ID code in this sample.
Here is the most basic call made from my server:
<MvAssign name="cstring"
value="{'http://testing.shippingapis.com/ShippingAPITest.dll?API=RateV2&XML=<RateV2Request
USERID=' $ asciichar(34) $ 'xxxx' $ asciichar(34) $ '><Package ID=' $
asciichar(34) $ '0' $ asciichar(34) $
'><Service>PRIORITY</Service><ZipOrigination>10022</ZipOrigination><ZipDest**ination>20008</ZipDestination><Pounds>10</Pounds><Ounces>5</Ounces><Contai*n*er>Flat
Rate Box</Container><Size>REGULAR</Size></Package></RateV2Request>'}">
<MvCall
action="{cstring}"
method="post">
<MvEVAL EXPR="{callvalue}">
</MvCall>
The response from the the USPS server is the following html page source
that states there is a parameter error. But, If I paste the http link
below in the address bar, it works just fine and the USPS returns the
correct response.
<html>
http://testing.shippingapis.com/ShippingAPITest.dll?API=RateV2&XML=<RateV2Request
USERID="xxxx"><Package
ID="0"><Service>PRIORITY</Service><ZipOrigination>10022</ZipOrigination><Zi**pDestination>20008</ZipDestination><Pounds>10</Pounds><Ounces>5</Ounces><C*o*ntainer>Flat
Rate
Box</Container><Size>REGULAR</Size></Package></RateV2Request><br><br>
<html>
<head>
<title>
Error
</title>
</head>
<body>
The parameter is incorrect.
</body>
</html>
</html>
Here is the the correct reponse from the USPS server after pasting the translated cstring contents directly to the address bar, but fails with MvCall.
<?xml version="1.0" ?>
- <RateV2Response>
- <Package ID="0">
<ZipOrigination>10022</ZipOrigination>
<ZipDestination>20008</ZipDestination>
<Pounds>10</Pounds>
<Ounces>5</Ounces>
<Container>Flat Rate Box</Container>
<Size>REGULAR</Size>
<Zone>3</Zone>
- <Postage>
<MailService>Priority Mail Flat Rate Box (11.25" x 8.75" x
6")</MailService>
<Rate>7.70</Rate>
</Postage>
- <Postage>
<MailService>Priority Mail Flat Rate Box (14" x 12" x
3.5")</MailService>
<Rate>7.70</Rate>
</Postage>
</Package>
</RateV2Response>
Am I overlooking something in the way I'm calling it from Miva?
I really don't want to switch to another language like PHP to do this request, but I'm starting to feel I have to.
Thanks in advance.