title: How to parse xml result received from client
body: <p>Following code sends a request to a web service and receive the results. It successfully sends the request and show the results on console, the problem is that I can not parse the xml into object.</p>
  
  <p><strong>Code</strong>   </p>
  
  <pre><code>    Request req = new Request();
      req.setLanguage(lang);
  
      webser webs = new webser();
      webs.setRequest(req);
  
          JAXBContext context = JAXBContext.newInstance(webser.class);
          Marshaller m = context.createMarshaller();
          m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
  
          URL url = new URL("http://example.com");
          HttpURLConnection connection = (HttpURLConnection) url.openConnection();
          connection.setDoOutput(true);
          connection.setInstanceFollowRedirects(false);
          connection.setRequestMethod("POST");
          connection.setRequestProperty("Content-Type", "application/xml");
  
          OutputStream os = connection.getOutputStream();
          m.marshal(webs, os);
  
          WebResponse result = (WebResponse) JAXB.unmarshal(connection.getInputStream(), WebResponse.class);
          System.err.println("&gt;&gt;&gt;&gt;&gt;&gt;" + result.getResponse().getInfogetPersons().get(0).getId()); 
                                                        //does not return anything
  
          //**** populating the object manually ****
          String edd = "&gt;";
          person p1 = new Person();
          p1.setId(1);
          Person p2 = new Person();
          p2.setId(2);
  
          Info info = new linfo();
          info.getPersons().add(p1);
          info.gePersons().add(p2);
  
          Response r = new Response();
          r.setinfo(info);
  
          WebResponse result2 = new WebResponse();
          result2.setResponse(r);
  
          JAXB.marshal(result2, edd);
          System.err.println("Result:" + edd);   &lt;&lt; does not return anything
  
          connection.disconnect();
  
      } catch (IOException e) {
          return e.getMessage(); 
      } catch (JAXBException e) {
          return e.getMessage();
      }
  </code></pre>
  
  <p><strong>WebResponse.java</strong></p>
  
  <pre><code>@XmlRootElement
  public class WebResponse {
  
      @XmlElement(name = "Response")
      private Response response = null;
  
      public Response getResponse() {
          return response;
      }
  
      public void setResponse(Response response) {
          this.response = response;
      }  
  }
  </code></pre>
  
  <p><strong>Response.java</strong></p>
  
  <pre><code>@XmlRootElement
  public class Response {
     @XmlRootElement (name = "Info")
     private Info info;
     ...
  }
  </code></pre>
  
  <p><strong>Info.java</strong></p>
  
  <pre><code>   @XmlRootElement
     public class Info {
        @XmlRootElement ( name = "Person")
        private List&lt;Person&gt; person;
        ....
     }
  </code></pre>
  
  <p><strong>Person.java</strong></p>
  
  <pre><code>   @XmlRootElement
     public class Person{
  
        private int Id;
  
        @XmlElement (name = "Id")
        public int getId() {
          return Id;
        }
  
        public void setId(int Id) {
          this.Id = Id;
        }
     }
  </code></pre>
  
  <p><strong>Actual Response from Server</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;WebResponse&gt;
        &lt;Response target="test"&gt;
             &lt;Info&gt;
                 &lt;Person&gt;
                     &lt;Id&gt;83094&lt;/Id&gt;
                     &lt;Age&gt;34&lt;/Age&gt;
                     &lt;FGs&gt;
                         &lt;HF&gt;0&lt;/HF&gt;
                         &lt;HI&gt;1&lt;/HI&gt;
                     &lt;/FGs&gt;
                     &lt;Rt&gt;
                            &lt;Rid parentid="412404"&gt;201735813&lt;/Rid&gt;
                            &lt;Rname&gt;Special&lt;/Rname&gt;
                            &lt;Ca&gt;2&lt;/Ca&gt;
                            &lt;link&gt;www.google.com/test&lt;/link&gt;
                    &lt;/Rt&gt;
                    &lt;Rt&gt;
                            &lt;Rid parentid="777777"&gt;787878&lt;/Rid&gt;
                            &lt;Rname&gt;Standard&lt;/Rname&gt;
                            &lt;Ca&gt;7&lt;/Ca&gt;
                            &lt;link&gt;www.yahoo.com/blank&lt;/link&gt;
                    &lt;/Rt&gt;
               &lt;/Person&gt;
               &lt;Person&gt;
                 ....
                &lt;/Person&gt;
                ......
           &lt;/Info&gt;
           .....
  </code></pre>