title: Can not unmarshall the SOAP response
body: <p>I could send a request and receive the response but I can not parse the response. It returns the following error: </p>
  
  <pre><code>Local Name:Body
  error is here
  java.lang.NullPointerException
      at com.ticketmaster.ticketmaster.TicketMaster.Search(TicketMaster.java:119)
      at com.ticketmaster.ticketmaster.App.main(App.java:12)
  </code></pre>
  
  <p><strong>Code</strong></p>
  
  <pre><code>    SOAPMessage response
              = connection.call(message, endpoint);
  
      connection.close();
          SOAPMessage sm = response;
          SOAPBody sb = response.getSOAPBody();
          System.err.println("Node Name:" + sb.getNodeName());  //return nothing
          System.err.println("Local Name:" + sb.getLocalName());  //return Local Name:Body
  
          DOMSource source = new DOMSource(sb);
          results = (FindEventsResponse) JAXB.unmarshal(source, FindEventsResponse.class);
          System.err.println("Results size: " + this.results.returnTag.results.item.get(0).getName());
  
  } catch (Exception ex) {
      System.err.println("error is here");
      ex.printStackTrace();
  }
  </code></pre>
  
  <p><strong>Response:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
                     xmlns:ns1="http://ticketmaster.productserve.com/v2/soap.php" 
                     xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                     xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
                     SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;
      &lt;SOAP-ENV:Body&gt;
          &lt;ns1:findEventsResponse&gt;
              &lt;return xsi:type="ns1:Response"&gt;
                  &lt;details xsi:type="ns1:Details"&gt;
                      &lt;totalResults xsi:type="xsd:int"&gt;20662&lt;/totalResults&gt;
                      &lt;totalPages xsi:type="xsd:int"&gt;414&lt;/totalPages&gt;
                      &lt;currentPage xsi:type="xsd:int"&gt;1&lt;/currentPage&gt;
                      &lt;resultsPerPage xsi:type="xsd:int"&gt;50&lt;/resultsPerPage&gt;
                  &lt;/details&gt;
                  &lt;results SOAP-ENC:arrayType="ns1:Event[50]" xsi:type="ns1:ArrayOfEvent"&gt;
                      &lt;item xsi:type="ns1:Event"&gt;
                          &lt;eventId xsi:type="xsd:int"&gt;1516682&lt;/eventId&gt;
                          &lt;ticketmasterEventId xsi:type="xsd:string"&gt;18004C6E8D7218A8&lt;/ticketmasterEventId&gt;
                          &lt;status xsi:type="xsd:string"&gt;onSale&lt;/status&gt;
                          &lt;name xsi:type="xsd:string"&gt;The Art of the Brick&lt;/name&gt;
                          &lt;url xsi:type="xsd:string"&gt;http://www.ticketmaster.ie/event/18004C6E8D7218A8?camefrom=CFC_UK_BUYAT&amp;amp;brand=[=BRAND=]&lt;/url&gt;
                          &lt;eventDate xsi:type="xsd:string"&gt;2014-05-23 10:00:00&lt;/eventDate&gt;
                          &lt;onSaleDate xsi:type="xsd:string"&gt;0000-00-00 00:00:00&lt;/onSaleDate&gt;
                          &lt;preSaleDate xsi:type="xsd:string"&gt;0000-00-00 00:00:00&lt;/preSaleDate&gt;
                          &lt;category xsi:type="xsd:string"&gt;Exhibitions&lt;/category&gt;
                          &lt;categoryId xsi:type="xsd:int"&gt;754&lt;/categoryId&gt;
                          &lt;parentCategory xsi:type="xsd:string"&gt;Family &amp;amp;amp; Attractions&lt;/parentCategory&gt;
                          &lt;parentCategoryId xsi:type="xsd:int"&gt;10003&lt;/parentCategoryId&gt;
                          &lt;minPrice xsi:type="xsd:float"&gt;17&lt;/minPrice&gt;
                          &lt;maxPrice xsi:type="xsd:float"&gt;17&lt;/maxPrice&gt;
                          &lt;artists SOAP-ENC:arrayType="ns1:Artist[1]" xsi:type="ns1:ArrayOfArtist"&gt;
                              &lt;item xsi:type="ns1:Artist"&gt;
                                  &lt;artistId xsi:type="xsd:int"&gt;1806028&lt;/artistId&gt;
                                  &lt;ticketmasterArtistId xsi:type="xsd:int"&gt;1663495&lt;/ticketmasterArtistId&gt;
                                  &lt;name xsi:type="xsd:string"&gt;The Art of the Brick&lt;/name&gt;
                                  &lt;url xsi:type="xsd:string"&gt;http://www.ticketmaster.co.uk/The-Art-of-the-Brick-tickets/artist/1663495?camefrom=CFC_UK_BUYAT&amp;amp;brand=[=BRAND=]&lt;/url&gt;
                                  &lt;imageUrl xsi:type="xsd:string"&gt;http://media.ticketmaster.com/tm/en-us/tmimages/TM_GenCatImgs_Generic_BW.jpg&lt;/imageUrl&gt;
                                  &lt;category xsi:type="xsd:string"&gt;Miscellaneous&lt;/category&gt;
                                  &lt;categoryId xsi:type="xsd:int"&gt;0&lt;/categoryId&gt;
                                  &lt;parentCategory xsi:type="xsd:string"&gt;Miscellaneous&lt;/parentCategory&gt;
                                  &lt;parentCategoryId xsi:type="xsd:int"&gt;10005&lt;/parentCategoryId&gt;
                              &lt;/item&gt;
                          &lt;/artists&gt;
                          &lt;venue xsi:type="ns1:Venue"&gt;
                              &lt;venueId xsi:type="xsd:int"&gt;3331&lt;/venueId&gt;
                              &lt;ticketmasterVenueId xsi:type="xsd:int"&gt;198292&lt;/ticketmasterVenueId&gt;
                              &lt;name xsi:type="xsd:string"&gt;Ambassador Theatre&lt;/name&gt;
                              &lt;street xsi:type="xsd:string"&gt;Oconnell Street&lt;/street&gt;
                              &lt;city xsi:type="xsd:string"&gt;Dublin&lt;/city&gt;
                              &lt;country xsi:type="xsd:string"&gt;United Kingdom&lt;/country&gt;
                              &lt;postcode xsi:type="xsd:string"&gt;Dublin 1&lt;/postcode&gt;
                              &lt;url xsi:type="xsd:string"&gt;http://www.ticketmaster.ie/Ambassador-Theatre-tickets-Dublin/venue/198292?camefrom=CFC_UK_BUYAT&amp;amp;brand=&lt;/url&gt;
                              &lt;imageUrl xsi:type="xsd:string"&gt;http://media.ticketmaster.co.uk/tmimages/TM_GenVenueImg_BW.jpg&lt;/imageUrl&gt;
                              &lt;state xsi:type="xsd:string"&gt;&lt;/state&gt;
                          &lt;/venue&gt;
                      &lt;/item&gt;
                      &lt;item xsi:type="ns1:Event"&gt;
                       ....
  </code></pre>
  
  <p><strong>Model Classes</strong></p>
  
  <pre><code>@XmlRootElement
  @XmlAccessorType(XmlAccessType.FIELD)
  public class FindEventsResponse {
      @XmlElement(name = "return")
      Return returnTag;
  
      public FindEventsResponse() {
         this.returnTag = new Return();
      }
      getter and setter
  
  }
  
  @XmlRootElement
  @XmlAccessorType(XmlAccessType.FIELD)
  public class Return {
      @XmlElement(name = "details")
      Details details;
      @XmlElement(name = "results")
      Results results;
  
      public Return(Details details, Results results) {
         this.details = new Details();
         this.results = new Results();
      }
      getters and setters
  
  
  }
  
  @XmlRootElement
  @XmlAccessorType(XmlAccessType.FIELD)
  public class Details {
  
      @XmlElement(name = "totalResults")
      int totalResults;
      @XmlElement(name = "totalPages")
      int totalPages;
      @XmlElement(name = "currentPage")
      int currentPage;
      @XmlElement(name = "resultPerPage")
      int resultsPerPage;
  
       getters and setters
  
  }
  
  @XmlRootElement
  @XmlAccessorType(XmlAccessType.FIELD)
  public class Results {
      @XmlElement(name = "item")
      List&lt;Item&gt; item;
  
      public Results() {
         this.item = new ArrayList();
      }
      getter and setter
  
  
  
  }
  
  @XmlRootElement
  @XmlAccessorType(XmlAccessType.FIELD)
  public class Item {
  
      @XmlElement(name = "eventId")
      int eventId;
      @XmlElement(name = "ticketmasterEventId")
      String ticketmasterEventId;
      @XmlElement(name = "status")
      String status;
      @XmlElement(name = "name")
      String name;
      @XmlElement(name = "url")
      String url;
      @XmlElement(name = "eventDate")
      String eventDate;
      @XmlElement(name = "onSaleDate")
      String onSaleDate;
      @XmlElement(name = "preSaleDate")
      String preSaleDate;
      @XmlElement(name = "category")
      String category;
      @XmlElement(name = "categoryId")
      int categoryId;
      @XmlElement(name = "parentCategory")
      String parentCategory;
      @XmlElement(name = "parentCategoryId")
      int parentCategoryId;
      @XmlElement(name = "minPrice")
      int minPrice;
      @XmlElement(name = "maxPrice")
      int maxPrice;
      @XmlElement(name = "artists")
      private Artists artist;
      @XmlElement(name = "venue")
      private Venue venue;
  
      public Item() {
         this.artist = new Artists();
         this.venue = new Venue();
      }
  
      getters and setters
  
  }
  
  @XmlRootElement
  @XmlAccessorType(XmlAccessType.FIELD)
  public class Artists {
      @XmlElement(name = "artists")
      private ArtistItem item;
  
      public Artists() {
          this.item = new ArtistItem();
      }
      getter and setter
  }
  
  @XmlRootElement
  @XmlAccessorType(XmlAccessType.FIELD)
  public class ArtistItem {
  
      @XmlElement(name = "artistId")
      int artistId;
      @XmlElement(name = "ticketmasterArtistsId")
      int ticketmasterArtistId;
      @XmlElement(name = "name")
      String name;
      @XmlElement(name = "url")
      String url;
      @XmlElement(name = "imageUrl")
      String imageUrl;
      @XmlElement(name = "category")
      String category;
      @XmlElement(name = "categoryId")
      int categoryId;
      @XmlElement(name = "parentCategory")
      String parentCategory;
      @XmlElement(name = "parentCategoryId")
      int parentCategoryId;
  
      getters and setters
  }
  
  @XmlRootElement
  @XmlAccessorType(XmlAccessType.FIELD)
  public class Venue {
  
      @XmlElement(name = "venueId")
      int venueId;
      @XmlElement(name = "ticketmasterVenueId")
      int ticketmasterVenueId;
      @XmlElement(name = "name")
      String name;
      @XmlElement(name = "street")
      String street;
      @XmlElement(name = "city")
      String city;
      @XmlElement(name = "country")
      String country;
      @XmlElement(name = "postcode")
      String postcode;
      @XmlElement(name = "url")
      String url;
      @XmlElement(name = "imageUrl")
      String imageUrl;
      @XmlElement(name = "state")
      String state;
  
      getters and setters
  }
  </code></pre>
  
  <p>Based on one of the following answers, I marshalled the result and it shows a wrong response.</p>
  
  <p><strong>package-info.java</strong></p>
  
  <pre><code>@XmlSchema( 
      namespace = "http://ticketmaster.productserve.com/v2/soap.php",
      elementFormDefault = XmlNsForm.UNQUALIFIED) 
  package com.ticketmaster.ticketmaster;
  import javax.xml.bind.annotation.XmlNsForm;
  import javax.xml.bind.annotation.XmlSchema;
  </code></pre>
  
  <p><strong>Code</strong></p>
  
  <pre><code>    SOAPBody sb = response.getSOAPBody();
  System.err.println("&gt;&gt;"+ sb.getFirstChild().getNodeName());
  Iterator itr = sb.getChildElements();
  while(itr.hasNext()){
      Object element = itr.next();
      System.err.println(element + " ");
  }
  Document d = sb.extractContentAsDocument();
  System.err.println("result of d:"+d.getTextContent());
  DOMSource source = new DOMSource(d);
  results = (FindEventsResponse) JAXB.unmarshal(source, FindEventsResponse.class);
  System.err.println("results&gt;"+results.getReturnTag().getResults().getItem().get(0).getName());
  </code></pre>
  
  <p><strong>Error is</strong></p>
  
  <pre><code>.....
  &gt;&lt;city xsi:type="xsd:string"&gt;London&lt;/city&gt;&lt;country xsi:type="xsd:string"&gt;United Kingdom&lt;/country&gt;&lt;postcode xsi:type="xsd:string"&gt;SE1 8XX&lt;/postcode&gt;&lt;url xsi:type="xsd:string"&gt;http://www.ticketmaster.co.uk/The-London-Wonderground-tickets-London/venue/253993?camefrom=CFC_UK_BUYAT&amp;amp;brand=&lt;/url&gt;&lt;imageUrl xsi:type="xsd:string"&gt;http://media.ticketmaster.co.uk/tmimages/TM_GenVenueImg_BW.jpg&lt;/imageUrl&gt;&lt;state xsi:type="xsd:string"&gt;&lt;/state&gt;&lt;/venue&gt;&lt;/item&gt;&lt;/results&gt;&lt;/return&gt;&lt;/ns1:findEventsResponse&gt;&lt;/SOAP-ENV:Body&gt;&lt;/SOAP-ENV:Envelope&gt;
  
  &gt;&gt;ns1:findEventsResponse
  [ns1:findEventsResponse: null] 
  result of d:null
  error is here
  
  java.lang.IllegalArgumentException: prefix xsd is not bound to a namespace
      at com.sun.xml.internal.bind.DatatypeConverterImpl._parseQName(DatatypeConverterImpl.java:346)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.LeafPropertyXsiLoader.selectLoader(LeafPropertyXsiLoader.java:75)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.LeafPropertyXsiLoader.startElement(LeafPropertyXsiLoader.java:58)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:486)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:465)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:60)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:135)
      at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:229)
      at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:266)
      at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:235)
      at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:266)
      at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:235)
      at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:266)
      at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:235)
      at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:266)
      at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:235)
      at com.sun.xml.internal.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:112)
      at com.sun.xml.internal.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:95)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:312)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:288)
      at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:238)
      at javax.xml.bind.JAXB.unmarshal(JAXB.java:259)
      at com.ticketmaster.ticketmaster.TicketMaster.Search(TicketMaster.java:132)
      at com.ticketmaster.ticketmaster.App.main(App.java:12)   
  </code></pre>