USPS shippingapis returns "400 Bad Request"

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 Jahre weitere
Can anyone help me with this. var response = request.GetResponse(); returns "400 Bad Request" in proc


private string DoRequest(string url, string requestString)
        {
            byte[] bytes = new ASCIIEncoding().GetBytes(requestString);
            var request = (HttpWebRequest)WebRequest.Create(url);
            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded";
            request.ContentLength = bytes.Length;
            var requestStream = request.GetRequestStream();
            requestStream.Write(bytes, 0, bytes.Length);
            requestStream.Close();
            var response = request.GetResponse();
            string responseXML = string.Empty;
            using (var reader = new StreamReader(response.GetResponseStream()))
                responseXML = reader.ReadToEnd();

            return responseXML;
        }


value of requestString is :

API=RateV3&XML=<RateV3Request USERID=\"MYUSR\" PASSWORD="MYPWD"><Package ID="0"><Service>ALL</Service><ZipOrigination>90503</ZipOrigination><ZipDestination>90210</ZipDestination><Pounds>2</Pounds><Ounces>0</Ounces><Size>Regular</Size><Machinable>FALSE</Machinable></Package></RateV3Request>


and value of url is:


http://production.shippingapis.com/ShippingAPI.dll


USPS approve me production request. I am trying to get this from VS in local environment.

nopCommerce version is 1.9.

Thanks!
12 Jahre weitere
Did they change your account to active? I had same issue and this cleared it up.

Mark
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.