Send XML requests

Generic request method for logged in users to send XML requests to the server through an action name and a query string.

Note:

See the sample files XMLApiAdapter.java and createmeeting.jsp.

The request method in the sample takes an action and a query string and sends the BREEZESESSION cookie value back to the server in the request header:

 protected Element request(String action, String queryString)
  throws XMLApiException {
try {
if (breezesession == null)
login();
  URL url = breezeUrl(action, queryString);
  URLConnection conn = url.openConnection();
  conn.setRequestProperty("Cookie", "BREEZESESSION=" + breezesession);
  conn.connect();
  InputStream resultStream = conn.getInputStream();
  Document doc = new SAXBuilder(false).build(resultStream);
return doc.getRootElement();
} catch (IOException ioe) {
  throw new XMLApiException("A communication error occurred", ioe);
} catch (JDOMException jde) {
  throw new XMLApiException("A parsing error occurred", jde);
}
}
 protected Element request(String action, String queryString)   throws XMLApiException {   try {   if (breezesession == null)   login();     URL url = breezeUrl(action, queryString);     URLConnection conn = url.openConnection();   conn.setRequestProperty("Cookie", "BREEZESESSION=" + breezesession);   conn.connect();     InputStream resultStream = conn.getInputStream();   Document doc = new SAXBuilder(false).build(resultStream);   return doc.getRootElement();     } catch (IOException ioe) {   throw new XMLApiException("A communication error occurred", ioe);   } catch (JDOMException jde) {   throw new XMLApiException("A parsing error occurred", jde);   }  }
 protected Element request(String action, String queryString) 
             throws XMLApiException { 
         try { 
             if (breezesession == null) 
                 login(); 
  
             URL url = breezeUrl(action, queryString); 
  
             URLConnection conn = url.openConnection(); 
             conn.setRequestProperty("Cookie", "BREEZESESSION=" + breezesession); 
             conn.connect(); 
  
             InputStream resultStream = conn.getInputStream(); 
             Document doc = new SAXBuilder(false).build(resultStream); 
             return doc.getRootElement(); 
  
         } catch (IOException ioe) { 
             throw new XMLApiException("A communication error occurred", ioe); 
         } catch (JDOMException jde) { 
             throw new XMLApiException("A parsing error occurred", jde); 
         }  
 }

Get help faster and easier

New user?