|    
			
				03/06/2008, 09:23
			
			
			  | 
  |   |  |  |  Fecha de Ingreso: abril-2008 
						Mensajes: 17
					 Antigüedad: 17 años, 6 meses Puntos: 0 |  | 
  |  Acceder al xml de un servicio web  
  Hola queria preguntaros como accedeis al xml de un servicio web, yo hasta ahora estoy usando httpclient pero me da errores de vez en cuando. Lo hago asi: 
 public class ObtenerXML {
 
 
 public static String realizarAccion(String url) throws HttpException {
 
 String responseBody = null;
 
 // Create an instance of HttpClient.
 HttpClient client = new HttpClient();
 //client.getParams().setParameter("http.protocol.con  tent-charset", "UTF-8");
 
 
 // Create a method instance.
 GetMethod method = new GetMethod(url);
 
 // Provide custom retry handler is necessary
 method.getParams().setParameter(HttpMethodParams.R  ETRY_HANDLER,
 new DefaultHttpMethodRetryHandler(3, false));
 // method.getParams().setParameter("http.protocol.con  tent-charset", "UTF-8");
 
 
 try {
 // Execute the method.
 int statusCode = client.executeMethod(method);
 
 if (statusCode != HttpStatus.SC_OK) {
 System.err.println("Method failed: " + method.getStatusLine());
 }
 
 // Read the response body.
 responseBody = method.getResponseBodyAsString();
 
 // Deal with the response.
 // Use caution: ensure correct character encoding and is not binary data
 
 
 } catch (HttpException e) {
 System.err.println("Fatal protocol violation: " + e.getMessage());
 e.printStackTrace();
 } catch (IOException e) {
 System.err.println("Fatal transport error: " + e.getMessage());
 e.printStackTrace();
 } finally {
 // Release the connection.
 method.releaseConnection();
 }
 
 return ((responseBody));
 }
 
 }
 
 Si conoceis alguna forma mas eficiente de hacerlo os lo agrdeceria.
 
 Muchas gracias!!
     |