0

我无法将 xml 数据发布到服务器。执行对服务器的请求时出错。错误是内部服务器错误。请帮助我

    public String uploadfiletoserver(String xml)
                int TIMEOUT_MILLISEC = 10000; // = 10 seconds
                HttpParams httpParams = new BasicHttpParams();
                HttpConnectionParams.setConnectionTimeout(httpParams, TIMEOUT_MILLISEC);
                HttpConnectionParams.setSoTimeout(httpParams, TIMEOUT_MILLISEC);
                HttpClient client = new DefaultHttpClient(httpParams);

                HttpPost request = new HttpPost(
                        url_context + "/orders/order");
                try {
                     Log.i("YMApps Res","In try for setting url encoded form");
                    StringEntity entity = new StringEntity(xmlString);
                    entity.setContentType(new BasicHeader(HTTP.CONTENT_TYPE,
                            "application/xml"));
                    request.setEntity(entity);

                    ResponseHandler<String> handler = new BasicResponseHandler();
                    Log.i("YMApps Res","Inside try before execute");
                    return client.execute(request, handler);
                } catch (Throwable e) {
                    Log.i("YMApps Res","Inside catch execute");
                    e.printStackTrace();
                   }
                Log.i("YMApps Res","After try and catch in upload file to server");
                return "";
}
4

0 回答 0