0

我正在尝试使用 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());

这里有什么问题?

4

0 回答 0