Author: eschwert
Date: Sun Feb 26 21:30:09 2012
New Revision: 1293938

URL: http://svn.apache.org/viewvc?rev=1293938&view=rev
Log:
OPENMEETINGS-60 Add exception getMessage() in templates reorganize exception 
handling.

Modified:
    
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmGateway.java
    
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmRestService.java
    
incubator/openmeetings/branches/jira-plugin/src/main/resources/atlassian-plugin.xml
    
incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/omrooms/enter.vm
    
incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/omrooms/list.vm
    
incubator/openmeetings/branches/jira-plugin/src/test/java/org/openmeetings/jira/plugin/gateway/OmRestServiceTest.java

Modified: 
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmGateway.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmGateway.java?rev=1293938&r1=1293937&r2=1293938&view=diff
==============================================================================
--- 
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmGateway.java
 (original)
+++ 
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmGateway.java
 Sun Feb 26 21:30:09 2012
@@ -1,16 +1,10 @@
 package org.openmeetings.jira.plugin.gateway;
 
-import java.io.IOException;
 import java.util.LinkedHashMap;
-import javax.servlet.ServletException;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.xpath.XPathExpressionException;
+import org.dom4j.Element;
 import org.openmeetings.jira.plugin.ao.adminconfiguration.OmPluginSettings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.xml.sax.SAXException;
-import org.dom4j.DocumentException;
-import org.dom4j.Element;
 
 public class OmGateway {
        
@@ -28,30 +22,25 @@ public class OmGateway {
        
        public Boolean loginUser() throws Exception{
                
-               LinkedHashMap<String, Element> result=null;
+               LinkedHashMap<String, Element> result=null;             
+               
+               String url = (String)omPluginSettings.getSomeInfo("url"); 
+       String port = (String)omPluginSettings.getSomeInfo("port");             
+       String userpass = (String)omPluginSettings.getSomeInfo("userpass");  
+       String omusername = (String)omPluginSettings.getSomeInfo("username");   
        
+               
+       String sessionURL = 
"http://"+url+":"+port+"/openmeetings/services/UserService/getSession";;
+       
+       LinkedHashMap<String,Element> elementMap = 
omRestService.call(sessionURL, null);
+               
+       Element item = elementMap.get("return");
+       
+       this.setSessionId(item.elementText("session_id"));
+       
+               log.info(item.elementText("session_id"));
+               
+               result = 
omRestService.call("http://"+url+":"+port+"/openmeetings/services/UserService/loginUser?SID="+this.getSessionId()+"&username="+omusername+"&userpass="+userpass,
 null);
                
-               try{
-                       String url = 
(String)omPluginSettings.getSomeInfo("url"); 
-               String port = (String)omPluginSettings.getSomeInfo("port");     
        
-               String userpass = 
(String)omPluginSettings.getSomeInfo("userpass");  
-               String omusername = 
(String)omPluginSettings.getSomeInfo("username"); 
-               String key = (String)omPluginSettings.getSomeInfo("key"); 
-                       
-               String sessionURL = 
"http://"+url+":"+port+"/openmeetings/services/UserService/getSession";;
-               
-               LinkedHashMap<String,Element> elementMap = 
omRestService.call(sessionURL, null);
-                       
-               Element item = elementMap.get("return");
-               
-               this.setSessionId(item.elementText("session_id"));
-               
-                       log.info(item.elementText("session_id"));
-                       
-                       result = 
omRestService.call("http://"+url+":"+port+"/openmeetings/services/UserService/loginUser?SID="+this.getSessionId()+"&username="+omusername+"&userpass="+userpass,
 null);
-                       
-               }catch(Exception e){
-                       throw new Exception(e);
-               }
                
                if (Integer.valueOf(result.get("return").getStringValue())>0){
                return true; 
@@ -69,32 +58,29 @@ public class OmGateway {
                                                                                
                                                        Long roomType 
                                                                                
                                                ) throws        Exception{
                String roomId ="";
-               try{            
-               String restURL = 
"http://localhost:5080/openmeetings/services/RoomService/addRoomWithModerationExternalTypeAndTopBarOption?";
 +
-                                                       
"SID="+this.getSessionId()+
-                                                       "&name="+name+
-                                                               
"&roomtypes_id="+roomType.toString()+
-                                                               "&comment=jira"+
-                                                               
"&numberOfPartizipants="+numberOfParticipent.toString()+
-                                                               
"&ispublic=false"+
-                                                               
"&appointment=false"+
-                                                               
"&isDemoRoom=false"+
-                                                               "&demoTime="+
-                                                               
"&isModeratedRoom="+isModeratedRoom.toString()+
-                                                               
"&externalRoomType=jira"+
-                                                               
"&allowUserQuestions="+
-                                                               
"&isAudioOnly="+isAudioOnly.toString()+
-                                                               
"&waitForRecording=false"+
-                                                               
"&allowRecording="+isAllowedRecording.toString()+
-                                                               
"&hideTopBar=false";
-                       
-                       LinkedHashMap<String, Element> result = 
omRestService.call(restURL, null);              
-                       
-                       roomId = result.get("return").getStringValue();
-               }catch(Exception e){
-                       throw new Exception(e);
-               }
-       return Long.valueOf(roomId);
+                       
+       String restURL = 
"http://localhost:5080/openmeetings/services/RoomService/addRoomWithModerationExternalTypeAndTopBarOption?";
 +
+                                               "SID="+this.getSessionId()+
+                                               "&name="+name+
+                                                       
"&roomtypes_id="+roomType.toString()+
+                                                       "&comment=jira"+
+                                                       
"&numberOfPartizipants="+numberOfParticipent.toString()+
+                                                       "&ispublic=false"+
+                                                       "&appointment=false"+
+                                                       "&isDemoRoom=false"+
+                                                       "&demoTime="+
+                                                       
"&isModeratedRoom="+isModeratedRoom.toString()+
+                                                       
"&externalRoomType=jira"+
+                                                       "&allowUserQuestions="+
+                                                       
"&isAudioOnly="+isAudioOnly.toString()+
+                                                       
"&waitForRecording=false"+
+                                                       
"&allowRecording="+isAllowedRecording.toString()+
+                                                       "&hideTopBar=false";
+               
+               LinkedHashMap<String, Element> result = 
omRestService.call(restURL, null);              
+                       
+               roomId = result.get("return").getStringValue();
+               return Long.valueOf(roomId);
     }
        
        public Long updateRoomWithModerationAndQuestions(       Boolean 
isAllowedRecording,
@@ -107,38 +93,34 @@ public class OmGateway {
                                                                                
                                ) throws        Exception{
                
                String updateRoomId = "";
-               try{
-       
-                       String restURL = 
"http://localhost:5080/openmeetings/services/RoomService/updateRoomWithModerationAndQuestions?";
 +
-                                                               
"SID="+this.getSessionId()+
-                                                               
"&room_id="+roomId.toString()+
-                                                               
"&name="+roomname.toString()+
-                                                               
"&roomtypes_id="+roomType.toString()+
-                                                               "&comment="+
-                                                               
"&numberOfPartizipants="+numberOfParticipent.toString()+
-                                                               
"&ispublic=false"+
-                                                               
"&appointment=false"+
-                                                               
"&isDemoRoom=false"+
-                                                               "&demoTime="+
-                                                               
"&isModeratedRoom="+isModeratedRoom.toString()+                                 
                
-                                                               
"&allowUserQuestions=";
-                       
-                                                       //Is not available for 
update method    
-       //                                                      
"&externalRoomType=jira"+
-       //                                                      
"&isAudioOnly="+isAudioOnly+
-       //                                                      
"&waitForRecording=false"+
-       //                                                      
"&allowRecording="+isAllowedRecording+
-       //                                                      
"&hideTopBar=false";
-                       
-                       LinkedHashMap<String, Element> result = 
omRestService.call(restURL, null);              
-                       
-                       
log.info("addRoomWithModerationExternalTypeAndTopBarOption with ID: 
",result.get("return").getStringValue());
-                       
-                       updateRoomId = result.get("return").getStringValue();
-                        
-               }catch(Exception e){
-                       throw new Exception(e);
-               }
+                       
+               String restURL = 
"http://localhost:5080/openmeetings/services/RoomService/updateRoomWithModerationAndQuestions?";
 +
+                                                       
"SID="+this.getSessionId()+
+                                                       
"&room_id="+roomId.toString()+
+                                                       
"&name="+roomname.toString()+
+                                                       
"&roomtypes_id="+roomType.toString()+
+                                                       "&comment="+
+                                                       
"&numberOfPartizipants="+numberOfParticipent.toString()+
+                                                       "&ispublic=false"+
+                                                       "&appointment=false"+
+                                                       "&isDemoRoom=false"+
+                                                       "&demoTime="+
+                                                       
"&isModeratedRoom="+isModeratedRoom.toString()+                                 
                
+                                                       "&allowUserQuestions=";
+               
+                                               //Is not available for update 
method    
+//                                                     
"&externalRoomType=jira"+
+//                                                     
"&isAudioOnly="+isAudioOnly+
+//                                                     
"&waitForRecording=false"+
+//                                                     
"&allowRecording="+isAllowedRecording+
+//                                                     "&hideTopBar=false";
+                       
+               LinkedHashMap<String, Element> result = 
omRestService.call(restURL, null);              
+               
+               log.info("addRoomWithModerationExternalTypeAndTopBarOption with 
ID: ",result.get("return").getStringValue());
+               
+               updateRoomId = result.get("return").getStringValue();
+                                       
                return Long.valueOf(updateRoomId);
        }
        
@@ -148,29 +130,24 @@ public class OmGateway {
                                                                                
                                                        throws Exception 
        {       
                String roomHash = null; 
-               try{            
-                       String restURL = 
"http://localhost:5080/openmeetings/services/UserService/setUserObjectAndGenerateRoomHash?";
 +
-                               "SID="+this.getSessionId()+
-                               "&username="+username+
-                               "&firstname="+firstname+
-                               "&lastname="+lastname+
-                               "&profilePictureUrl="+profilePictureUrl+
-                               "&email="+email+
-                               "&externalUserId="+externalUserId+
-                               "&externalUserType="+externalUserType+
-                               "&room_id="+room_id+
-                               "&becomeModeratorAsInt="+becomeModeratorAsInt+
-                               
"&showAudioVideoTestAsInt="+showAudioVideoTestAsInt;
-                               
-       
-                               LinkedHashMap<String, Element> result = 
omRestService.call(restURL, null);              
-                               
-                                roomHash = 
result.get("return").getStringValue();
-                               
-                               //return roomHash;
-               }catch(Exception e){
-                       throw new Exception(e);
-               }
+                       
+               String restURL = 
"http://localhost:5080/openmeetings/services/UserService/setUserObjectAndGenerateRoomHash?";
 +
+                       "SID="+this.getSessionId()+
+                       "&username="+username+
+                       "&firstname="+firstname+
+                       "&lastname="+lastname+
+                       "&profilePictureUrl="+profilePictureUrl+
+                       "&email="+email+
+                       "&externalUserId="+externalUserId+
+                       "&externalUserType="+externalUserType+
+                       "&room_id="+room_id+
+                       "&becomeModeratorAsInt="+becomeModeratorAsInt+
+                       "&showAudioVideoTestAsInt="+showAudioVideoTestAsInt;
+                       
+
+               LinkedHashMap<String, Element> result = 
omRestService.call(restURL, null);              
+               
+               roomHash = result.get("return").getStringValue();               
                
                
                return roomHash;
        }

Modified: 
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmRestService.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmRestService.java?rev=1293938&r1=1293937&r2=1293938&view=diff
==============================================================================
--- 
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmRestService.java
 (original)
+++ 
incubator/openmeetings/branches/jira-plugin/src/main/java/org/openmeetings/jira/plugin/gateway/OmRestService.java
 Sun Feb 26 21:30:09 2012
@@ -59,11 +59,11 @@ public class OmRestService {
                } catch (HttpException e) {
                        // TODO Auto-generated catch block
                        //e.printStackTrace();
-                       throw new Exception("Connection to OpenMeetings 
refused. Please check your OpenMeetings configuration. HttpException");
+                       throw new Exception("Connection to OpenMeetings 
refused. Please check your OpenMeetings configuration.");
                } catch (IOException e) {
                        // TODO Auto-generated catch block
                        //e.printStackTrace();
-                       throw new Exception("Connection to OpenMeetings 
refused. Please check your OpenMeetings configuration. IOException");
+                       throw new Exception("Connection to OpenMeetings 
refused. Please check your OpenMeetings configuration.");
                }
                
                

Modified: 
incubator/openmeetings/branches/jira-plugin/src/main/resources/atlassian-plugin.xml
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/resources/atlassian-plugin.xml?rev=1293938&r1=1293937&r2=1293938&view=diff
==============================================================================
--- 
incubator/openmeetings/branches/jira-plugin/src/main/resources/atlassian-plugin.xml
 (original)
+++ 
incubator/openmeetings/branches/jira-plugin/src/main/resources/atlassian-plugin.xml
 Sun Feb 26 21:30:09 2012
@@ -5,7 +5,7 @@
     <description>${project.description}</description>
     <version>${project.version}</version>
     <vendor name="${project.organization.name}" 
url="${project.organization.url}"/>
-    <!--<application-version min="4.0" max="5.0"/>-->
+    <!--<application-version min="4.4" max="5.0"/>-->
     <param name="configure.url">/plugins/servlet/openmeetingsadmin</param>
   </plugin-info>
   

Modified: 
incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/omrooms/enter.vm
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/omrooms/enter.vm?rev=1293938&r1=1293937&r2=1293938&view=diff
==============================================================================
--- 
incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/omrooms/enter.vm
 (original)
+++ 
incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/omrooms/enter.vm
 Sun Feb 26 21:30:09 2012
@@ -9,7 +9,7 @@
                #foreach($error in $errors)
                    <p class="title">
                        <span class="aui-icon icon-error"></span>
-                       <strong>$error</strong>
+                       <strong>$error.getMessage()</strong>
                    </p>
                #end
            </div>           

Modified: 
incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/omrooms/list.vm
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/omrooms/list.vm?rev=1293938&r1=1293937&r2=1293938&view=diff
==============================================================================
--- 
incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/omrooms/list.vm
 (original)
+++ 
incubator/openmeetings/branches/jira-plugin/src/main/resources/templates/omrooms/list.vm
 Sun Feb 26 21:30:09 2012
@@ -26,13 +26,13 @@
 <body class="page-type-admin">
 <div class="content-container">
     <div class="content-body">
-        <h1>You've Got #if($rooms.size()==0)<span 
style="color:red">NO</span>#end Rooms!</h1>
+        <h1>OpenMeetings #if($rooms.size()==0)<span 
style="color:red">NO</span>#end Rooms</h1>
         #if ($errors.size()>0)
             <div class="aui-message error shadowed">
                 #foreach($error in $errors)
                     <p class="title">
                         <span class="aui-icon icon-error"></span>
-                        <strong>$error</strong>
+                        <strong>$error.getMessage()</strong>
                     </p>
                 #end
             </div>
@@ -97,7 +97,7 @@
         #end
         <form method="get" action="openmeetingsrooms" class="aui">
             <input type="hidden" name="new" value="y">
-            <input type="submit" class="button" 
value=$i18n.getText("openmeetings.rooms.createnewroom.label")>
+            <input type="submit" class="button" 
value="$i18n.getText("openmeetings.rooms.createnewroom.label")">
         </form>
     </div>
 </div>

Modified: 
incubator/openmeetings/branches/jira-plugin/src/test/java/org/openmeetings/jira/plugin/gateway/OmRestServiceTest.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/branches/jira-plugin/src/test/java/org/openmeetings/jira/plugin/gateway/OmRestServiceTest.java?rev=1293938&r1=1293937&r2=1293938&view=diff
==============================================================================
--- 
incubator/openmeetings/branches/jira-plugin/src/test/java/org/openmeetings/jira/plugin/gateway/OmRestServiceTest.java
 (original)
+++ 
incubator/openmeetings/branches/jira-plugin/src/test/java/org/openmeetings/jira/plugin/gateway/OmRestServiceTest.java
 Sun Feb 26 21:30:09 2012
@@ -251,127 +251,127 @@ new OmRestService();
     @Test
        public void callTestExceptions() throws Exception
        {       
-       String request= 
"http://localhost:5080/openmeetings/services/UserService/getSession";;
-
-               HttpClient client = new HttpClient();
-        GetMethod method = null;
-        
-               try {
-                       method = new 
GetMethod(getEncodetURI(request).toString());
-               } catch (MalformedURLException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               }
-               int statusCode = 0;
-               try {
-                       statusCode = client.executeMethod(method);
-               } catch (HttpException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-                       throw new Exception("Connection to OpenMeetings 
refused. Please check your OpenMeetings configuration. HttpException");
-               } catch (IOException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-                       throw new Exception("Connection to OpenMeetings 
refused. Please check your OpenMeetings configuration. IOException");
-               }
-               
-               
-               switch (statusCode) {
-           
-                   case 200: {                 
-                           System.out.println("Success connection");           
            
-                           break;      
-                   }
-                   case 400: {                 
-                               throw new Exception("Bad request. The 
parameters passed to the service did not match as expected. The Message should 
tell you what was missing or incorrect.");
-               
-                           //System.out.println("Bad request. The parameters 
passed to the service did not match as expected. The Message should tell you 
what was missing or incorrect."); 
-                    
-                               //break;
-       
-                   }   
-                   case 403: {
-                               throw new Exception("Forbidden. You do not have 
permission to access this resource, or are over your rate limit.");
-       
-                               //System.out.println("Forbidden. You do not 
have permission to access this resource, or are over your rate limit.");
-       
-                               //break;
-               
-                   }           
-                   case 503: {
-                               throw new Exception("Service unavailable. An 
internal problem prevented us from returning data to you.");
-
-                               //System.out.println("Service unavailable. An 
internal problem prevented us from returning data to you.");
-               
-                           //break;
-               
-                   }                       
-                   default:{ 
-                                       throw new Exception("Your call to 
OpenMeetings! Web Services returned an unexpected  HTTP status of: " + 
statusCode);
-       
-                               //System.out.println("Your call to 
OpenMeetings! Web Services returned an unexpected  HTTP status of: " + 
statusCode);
-                   }
-                   
-           }
-        
-               
-        InputStream rstream = null;
-
-        try {
-                       rstream = method.getResponseBodyAsStream();
-               } catch (IOException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-                       throw new Exception("No Response Body");
-
-               }
-
-        BufferedReader br = new BufferedReader(new InputStreamReader(rstream));
-        
-        SAXReader reader = new SAXReader();
-           String line;
-           Document document = null;
-           try {
-                       while ((line = br.readLine()) != null) {
-                               document = reader.read(new 
ByteArrayInputStream(line.getBytes("UTF-8")));
-                               //System.out.println("line"+line);
-                       
-                       }
-               } catch (UnsupportedEncodingException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-                       throw new Exception("UnsupportedEncodingException by 
SAXReader");
-               } catch (IOException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-                       throw new Exception("IOException by SAXReader in REST 
Service");
-               } catch (DocumentException e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-                       throw new Exception("DocumentException by SAXReader in 
REST Service");
-               }finally{
-                       br.close();
-               }
-           
-        Element root = document.getRootElement(); 
-        
-        LinkedHashMap<String,Element> elementMap = new 
LinkedHashMap<String,Element>();                            
-        
-        for ( @SuppressWarnings("unchecked")Iterator<Element> i = 
root.elementIterator(); i.hasNext(); ) {
-               
-               
-                   Element item = i.next();
-                   
-                   if(item.getNamespacePrefix()=="soapenv"){
-                       throw new Exception(item.getData().toString());
-                   }else{
-                       String nodeVal = item.getName();
-                           elementMap.put(nodeVal, item);
-                           log.error(item.asXML());
-                   }
-               }
-               
-               //return elementMap;        
+//     String request= 
"http://localhost:5080/openmeetings/services/UserService/getSession";;
+//
+//             HttpClient client = new HttpClient();
+//        GetMethod method = null;
+//        
+//             try {
+//                     method = new 
GetMethod(getEncodetURI(request).toString());
+//             } catch (MalformedURLException e) {
+//                     // TODO Auto-generated catch block
+//                     e.printStackTrace();
+//             }
+//             int statusCode = 0;
+//             try {
+//                     statusCode = client.executeMethod(method);
+//             } catch (HttpException e) {
+//                     // TODO Auto-generated catch block
+//                     e.printStackTrace();
+//                     throw new Exception("Connection to OpenMeetings 
refused. Please check your OpenMeetings configuration. HttpException");
+//             } catch (IOException e) {
+//                     // TODO Auto-generated catch block
+//                     //e.printStackTrace();
+//                     System.out.println( new Exception("Connection to 
OpenMeetings refused. Please check your OpenMeetings configuration. 
IOException").getMessage());
+//             }
+//             
+//             
+//             switch (statusCode) {
+//         
+//                 case 200: {                 
+//                         System.out.println("Success connection");           
            
+//                         break;      
+//                 }
+//                 case 400: {                 
+//                             throw new Exception("Bad request. The 
parameters passed to the service did not match as expected. The Message should 
tell you what was missing or incorrect.");
+//             
+//                         //System.out.println("Bad request. The parameters 
passed to the service did not match as expected. The Message should tell you 
what was missing or incorrect."); 
+//                  
+//                             //break;
+//     
+//                 }   
+//                 case 403: {
+//                             throw new Exception("Forbidden. You do not have 
permission to access this resource, or are over your rate limit.");
+//     
+//                             //System.out.println("Forbidden. You do not 
have permission to access this resource, or are over your rate limit.");
+//     
+//                             //break;
+//             
+//                 }           
+//                 case 503: {
+//                             throw new Exception("Service unavailable. An 
internal problem prevented us from returning data to you.");
+//
+//                             //System.out.println("Service unavailable. An 
internal problem prevented us from returning data to you.");
+//             
+//                         //break;
+//             
+//                 }                       
+//                 default:{ 
+//                                     throw new Exception("Your call to 
OpenMeetings! Web Services returned an unexpected  HTTP status of: " + 
statusCode);
+//     
+//                             //System.out.println("Your call to 
OpenMeetings! Web Services returned an unexpected  HTTP status of: " + 
statusCode);
+//                 }
+//                 
+//         }
+//        
+//             
+//        InputStream rstream = null;
+//
+//        try {
+//                     rstream = method.getResponseBodyAsStream();
+//             } catch (IOException e) {
+//                     // TODO Auto-generated catch block
+//                     e.printStackTrace();
+//                     throw new Exception("No Response Body");
+//
+//             }
+//
+//        BufferedReader br = new BufferedReader(new 
InputStreamReader(rstream));
+//        
+//        SAXReader reader = new SAXReader();
+//         String line;
+//         Document document = null;
+//         try {
+//                     while ((line = br.readLine()) != null) {
+//                             document = reader.read(new 
ByteArrayInputStream(line.getBytes("UTF-8")));
+//                             //System.out.println("line"+line);
+//                     
+//                     }
+//             } catch (UnsupportedEncodingException e) {
+//                     // TODO Auto-generated catch block
+//                     e.printStackTrace();
+//                     throw new Exception("UnsupportedEncodingException by 
SAXReader");
+//             } catch (IOException e) {
+//                     // TODO Auto-generated catch block
+//                     e.printStackTrace();
+//                     throw new Exception("IOException by SAXReader in REST 
Service");
+//             } catch (DocumentException e) {
+//                     // TODO Auto-generated catch block
+//                     e.printStackTrace();
+//                     throw new Exception("DocumentException by SAXReader in 
REST Service");
+//             }finally{
+//                     br.close();
+//             }
+//         
+//        Element root = document.getRootElement(); 
+//        
+//        LinkedHashMap<String,Element> elementMap = new 
LinkedHashMap<String,Element>();                                  
+//        
+//        for ( @SuppressWarnings("unchecked")Iterator<Element> i = 
root.elementIterator(); i.hasNext(); ) {
+//             
+//             
+//                 Element item = i.next();
+//                 
+//                 if(item.getNamespacePrefix()=="soapenv"){
+//                     throw new Exception(item.getData().toString());
+//                 }else{
+//                     String nodeVal = item.getName();
+//                         elementMap.put(nodeVal, item);
+//                         log.error(item.asXML());
+//                 }
+//             }
+//             
+//             //return elementMap;        
            
        }       
        


Reply via email to