USPS Tracking API

时间:2013-08-17 22:06:51

标签: java usps

我正在尝试使用USPS跟踪API。当我向生产服务器发送请求时,我得到501响应代码。

 StringEntity se = new StringEntity( "<AddressValidateRequest USERID=\"xxxxxxxx\"><Address><Address1></Address1><Address2>6406 Ivy Lane</Address2><City>Greenbelt</City><State>MD</State><Zip5></Zip5><Zip4></Zip4></Address></AddressValidateRequest>", HTTP.UTF_8);
    se.setContentType("text/xml");
    HttpClient httpClient = new DefaultHttpClient(); 
    HttpContext localContext = new BasicHttpContext(); 
    HttpPost httpPost = new HttpPost("http://production.shippingapis.com/ShippingAPITest.dll?API=Verify&XML="); 
    httpPost.setEntity(se); 
    HttpEntity resEntity = httpPost.getEntity();
    System.out.println(EntityUtils.toString(resEntity));

    HttpResponse response = httpClient.execute(httpPost);

    System.out.println(response.toString());

这里有什么问题?

0 个答案:

没有答案